@scaleflex/asset-picker 0.2.6 → 0.2.8

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.
Files changed (52) hide show
  1. package/.claude/settings.local.json +39 -38
  2. package/dist/{asset-picker-Cc1NFvo6.js → asset-picker-CveN6PRs.js} +3393 -2512
  3. package/dist/{asset-picker-D62afrSd.cjs → asset-picker-jJyPEuMn.cjs} +882 -379
  4. package/dist/asset-picker.d.ts +9 -0
  5. package/dist/asset-picker.d.ts.map +1 -1
  6. package/dist/components/filters/filters.constants.d.ts.map +1 -1
  7. package/dist/components/header/ap-header.d.ts.map +1 -1
  8. package/dist/components/selection/ap-folder-resolve-dialog.d.ts +18 -0
  9. package/dist/components/selection/ap-folder-resolve-dialog.d.ts.map +1 -0
  10. package/dist/components/selection/ap-selection-bar.d.ts +4 -0
  11. package/dist/components/selection/ap-selection-bar.d.ts.map +1 -1
  12. package/dist/components/toolbar/ap-content-toolbar.d.ts.map +1 -1
  13. package/dist/components/views/ap-asset-row.d.ts +2 -0
  14. package/dist/components/views/ap-asset-row.d.ts.map +1 -1
  15. package/dist/components/views/ap-folder-card.d.ts +5 -10
  16. package/dist/components/views/ap-folder-card.d.ts.map +1 -1
  17. package/dist/components/views/ap-folder-row.d.ts +10 -1
  18. package/dist/components/views/ap-folder-row.d.ts.map +1 -1
  19. package/dist/components/views/ap-grid-view.d.ts +4 -0
  20. package/dist/components/views/ap-grid-view.d.ts.map +1 -1
  21. package/dist/components/views/ap-list-view.d.ts +9 -1
  22. package/dist/components/views/ap-list-view.d.ts.map +1 -1
  23. package/dist/components/views/ap-skeleton.d.ts +4 -0
  24. package/dist/components/views/ap-skeleton.d.ts.map +1 -1
  25. package/dist/controllers/marquee.controller.d.ts +4 -1
  26. package/dist/controllers/marquee.controller.d.ts.map +1 -1
  27. package/dist/controllers/selection.controller.d.ts +12 -0
  28. package/dist/controllers/selection.controller.d.ts.map +1 -1
  29. package/dist/define.cjs +1 -1
  30. package/dist/define.js +1 -1
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +1 -1
  35. package/dist/react.cjs +1 -1
  36. package/dist/react.d.ts +6 -1
  37. package/dist/react.d.ts.map +1 -1
  38. package/dist/react.js +25 -25
  39. package/dist/store/index.d.ts.map +1 -1
  40. package/dist/store/store.types.d.ts +2 -0
  41. package/dist/store/store.types.d.ts.map +1 -1
  42. package/dist/types/config.types.d.ts +15 -1
  43. package/dist/types/config.types.d.ts.map +1 -1
  44. package/dist/types/events.types.d.ts +7 -0
  45. package/dist/types/events.types.d.ts.map +1 -1
  46. package/dist/types/folder.types.d.ts +4 -0
  47. package/dist/types/folder.types.d.ts.map +1 -1
  48. package/dist/utils/file-type.d.ts +2 -0
  49. package/dist/utils/file-type.d.ts.map +1 -1
  50. package/dist/utils/thumbnail.d.ts +6 -0
  51. package/dist/utils/thumbnail.d.ts.map +1 -1
  52. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- "use strict";var Ss=Object.create;var jt=Object.defineProperty;var Cs=Object.getOwnPropertyDescriptor;var Es=Object.getOwnPropertyNames;var Fs=Object.getPrototypeOf,As=Object.prototype.hasOwnProperty;var Ts=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Es(e))!As.call(t,a)&&a!==s&&jt(t,a,{get:()=>e[a],enumerable:!(i=Cs(e,a))||i.enumerable});return t};var Ms=(t,e,s)=>(s=t!=null?Ss(Fs(t)):{},Ts(e||!t||!t.__esModule?jt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),l=require("lit/decorators.js");class Os{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Ls(){return new Os({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map})}class Ps{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}class Is{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}handleSelect(e,s,i){var d,h;const a=this.store.getState(),r=new Map(a.selectedAssets);if(!(((d=a.config)==null?void 0:d.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=a.assets;for(let g=u;g<=f;g++)p[g]&&r.set(p[g].uuid,p[g])}else i.metaKey||i.ctrlKey?r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e):(r.clear(),r.set(e.uuid,e));const c=(h=a.config)==null?void 0:h.maxSelections;c&&r.size>c||(this.lastClickedIndex=s,this.store.setState({selectedAssets:r}))}isSelected(e){return this.store.getState().selectedAssets.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var n;const i=(n=this.store.getState().config)==null?void 0:n.maxSelections,a=new Map,r=i?Math.min(e.length,i):e.length;for(let c=0;c<r;c++)a.set(e[c].uuid,e[c]);return this.store.setState({selectedAssets:a}),this.lastClickedIndex=-1,a.size}clearSelection(){this.store.setState({selectedAssets:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}}class Ds{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(i=>{var a;(a=i[0])!=null&&a.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const Ut=5,$e=40,Bt=15;class zs{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=i=>this.onMouseDown(i),this.handleMouseMove=i=>this.onMouseMove(i),this.handleMouseUp=()=>this.onMouseUp(),this.preventSelect=i=>i.preventDefault(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(i=>{if(!(i instanceof HTMLElement))return!1;if(i instanceof HTMLButtonElement||i instanceof HTMLInputElement)return!0;const a=i.tagName.toLowerCase();return!!(a.startsWith("ap-asset-")||a.startsWith("ap-folder-")||i.classList.contains("check")||i.classList.contains("check-box"))})}onMouseDown(e){if(e.button!==0||this.isInteractiveTarget(e))return;const s=this.container.getBoundingClientRect();this.startX=e.clientX-s.left+this.container.scrollLeft,this.startY=e.clientY-s.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){var s;if(this.container){if(!this._dragging){const i=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(i<Ut&&a<Ut)return;this._dragging=!0,this.isActive=!0,document.addEventListener("selectstart",this.preventSelect),(s=window.getSelection())==null||s.removeAllRanges(),this.preMarqueeSelection=new Map(this.store.getState().selectedAssets)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientX-s.left+this.container.scrollLeft,a=e.clientY-s.top+this.container.scrollTop;this.rect={x:Math.min(this.startX,i),y:Math.min(this.startY,a),width:Math.abs(i-this.startX),height:Math.abs(a-this.startY)},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,r=i<$e||a<$e;r&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):r||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let r=0;i<$e?r=-Bt*(1-i/$e):a<$e&&(r=Bt*(1-a/$e)),r!==0&&(this.container.scrollTop+=r,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}queryCards(){for(const e of Array.from(this.container.children))if(e.shadowRoot){const s=e.shadowRoot.querySelectorAll("[data-asset-uuid]");if(s.length>0)return s}return this.container.querySelectorAll("[data-asset-uuid]")}selectIntersecting(){var a;if(!this.container)return;const e=this.queryCards(),s=new Map(this.preMarqueeSelection);e.forEach(r=>{const n=r.getBoundingClientRect(),c=this.container.getBoundingClientRect(),d={x:n.left-c.left+this.container.scrollLeft,y:n.top-c.top+this.container.scrollTop,width:n.width,height:n.height},h=this.rect.x<d.x+d.width&&this.rect.x+this.rect.width>d.x&&this.rect.y<d.y+d.height&&this.rect.y+this.rect.height>d.y,u=r.dataset.assetUuid;if(h){const f=this.store.getState().assets.find(p=>p.uuid===u);f&&s.set(u,f)}});const i=(a=this.store.getState().config)==null?void 0:a.maxSelections;if(i&&s.size>i){const r=Array.from(s.entries()).slice(0,i);this.store.setState({selectedAssets:new Map(r)})}else this.store.setState({selectedAssets:s})}}class Rs{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`,e.mode==="sassKey"&&(this.sassKey=e.sassKey)}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}_applyAuthHeaders(e){this.sassKey?e["X-Filerobot-Key"]=this.sassKey:this.auth.mode==="securityTemplate"&&(e["X-Filerobot-Key"]=this.auth.securityTemplateKey)}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([c,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(c,d.join(",")):i.searchParams.set(c,String(d)))});const a={};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:r.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}}function Ns(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",i=t.sort_direction??"desc",a={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${a[s]||s}:${i}`,t.folder&&(e.folder=t.folder);const r=[];return t.search&&r.push(t.search),t.q&&r.push(t.q),r.length>0&&(e.q=r.join(" ")),e}async function Ye(t,e){const s=Ns(e);return t.request("/files",s)}async function Vt(t,e){const s={folder:e.folder,recursive:e.recursive??1},i=[];return e.search&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),t.request("/files/stats",s)}async function js(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const i=(e==null?void 0:e.sort_by)??"created_at",a=(e==null?void 0:e.sort_direction)??"asc",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[i]||i}:${a}`,await t.request("/folders",s)}async function Us(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Bs(t){return await t.request("/labels")}async function Vs(t){return((await t.request("/tags")).tags||[]).map(i=>({...i,label:i.names.en||Object.values(i.names)[0]||""})).filter(i=>i.label).sort((i,a)=>i.label.localeCompare(a.label))}async function qs(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}const m={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},z={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},y={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},Hs={AND:"AND"},_={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},dt={[_.DATE]:"date_",[_.BOOLEAN]:"bool_",[_.NUMERIC]:"num_",[_.DECIMAL2]:"dec_",[_.ATTACHMENTS_ASSETS]:"attach_",[_.ATTACHMENT_URI]:"uri_",[_.SELECT_ONE]:"one_",[_.MULTI_SELECT]:"multi_",[_.SUPERTAGS]:"tags_",[_.TEXT]:"text_",[_.TEXT_AREA]:"area_",[_.GEO_POINT]:"geo_",[_.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(dt).map(([t,e])=>[e,t]));const Jt=Object.values(dt),Ie={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},qt={EMPTY:"empty",NOT_EMPTY:"non-empty"},U="empty",B="non-empty",he="specific",ft=10,mt=10,Xe=10,es="filters:pinned:",ts="metadata:pinned:",Ht=[m.DATE,m.TYPE],ss=y.IS,Qe="20",Ze="1",Ks=0,Gs=[{key:m.DATE,label:"Date",icon:"calendar",type:"date"},{key:m.TYPE,label:"Format",icon:"file-type",type:"string"},{key:m.SIZE,label:"Size",icon:"scaling",type:"string"},{key:m.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:m.TAGS,label:"Tags",icon:"hash",type:"string"},{key:m.LABELS,label:"Labels",icon:"tag",type:"string"},{key:m.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:m.IMAGE,label:"Image",icon:"image",type:"string"},{key:m.COLOR,label:"Color",icon:"swatch-book",type:"string"}],Ys={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},Xs={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},Ct=[Ys,...Gs,Xs],ke={[m.TYPE]:"Format",[m.DATE]:"Date",[m.SIZE]:"Size",[m.LICENSE_EXPIRY]:"License expiry",[m.TAGS]:"Tags",[m.LABELS]:"Labels",[m.PRODUCT_REF]:"Products",[m.IMAGE]:"Image",[m.COLOR]:"Color",[m.METADATA]:"Metadata",[m.APPROVAL]:"Approval"},ae={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},as=[{value:ae.IMAGE,label:"Image",icon:"image"},{value:ae.VIDEO,label:"Video",icon:"clapperboard"},{value:ae.AUDIO,label:"Audio",icon:"music"},{value:ae.DOCUMENT,label:"Document",icon:"document"},{value:ae.ARCHIVE,label:"Archive",icon:"archive"},{value:ae.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:ae.FONTS,label:"Fonts",icon:"text"},{value:ae.OTHER,label:"Other",icon:"layout-grid"}],vt={RESOLUTION:0,ORIENTATION:1,FACES:2},Ws=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],Qs=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],Zs=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],is=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],Ft=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],rs=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],Js=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],ea=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],ta=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],bt=[{label:"Is",value:y.IS},{label:"Contains",value:y.CONTAINS_IN_TEXT}],X=[{label:"Is",value:y.IS},{label:"Is not",value:y.IS_NOT}],_t=[{label:"Is",value:y.IS_EXACT},{label:"Contains",value:y.IS},{label:"Does not contain",value:y.IS_NOT}],yt=[{label:"Is",value:y.IS},{label:"Greater than",value:y.GREATER_THAN_OR_EQUAL},{label:"Is not",value:y.IS_NOT},{label:"Less than",value:y.LESS_THAN_OR_EQUAL},{label:"Between",value:y.RANGE}],sa=[{label:"Is",value:y.IS_EXACT},{label:"Is not",value:y.IS_NOT}],Kt=[{label:"Contains",value:y.CONTAINS},{label:"Does not contain",value:y.IS_NOT}],aa=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],ge=[{label:"Empty",value:U},{label:"Not empty",value:B}],xt=[...ge,{label:"Specific",value:he}],ia=[{label:"Empty",value:U},{label:"Not empty",value:B},{label:"True",value:"true"},{label:"False",value:"false"}],Je={[_.DATE]:"calendar",[_.BOOLEAN]:"toggle-left",[_.NUMERIC]:"file-digit",[_.DECIMAL2]:"decimals-arrow-right",[_.ATTACHMENTS_ASSETS]:"paperclip",[_.ATTACHMENT_URI]:"link-2",[_.SELECT_ONE]:"circle-dot",[_.MULTI_SELECT]:"square-check",[_.SUPERTAGS]:"hash",[_.TEXT]:"text-initial",[_.TEXT_AREA]:"text-align-justify",[_.GEO_POINT]:"locate",[_.INTEGER_LIST]:"list-ordered"},ra={[_.TEXT]:"text",[_.TEXT_AREA]:"text",[_.NUMERIC]:"number",[_.DECIMAL2]:"number",[_.BOOLEAN]:"boolean",[_.SELECT_ONE]:"select-one",[_.MULTI_SELECT]:"multi-select",[_.SUPERTAGS]:"tags",[_.DATE]:"date",[_.GEO_POINT]:"geo",[_.ATTACHMENTS_ASSETS]:"attachment",[_.ATTACHMENT_URI]:"attachment",[_.INTEGER_LIST]:"attachment"};async function oa(t){var v,x;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,r=((i==null?void 0:i.model)??[])[Ks],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(b=>({uuid:b.uuid,label:b.label??b.name??"",variants:(b.variants??[]).map(k=>({api_value:k.api_value??k.value??"",internal_unique_value:k.internal_unique_value??k.api_value??"",label:k.label??k.name??""}))})).filter(b=>b.variants.length>1),h={};for(const b of d)h[b.uuid]=((v=b.variants[0])==null?void 0:v.api_value)??"";const u=(s==null?void 0:s.project_branding)??((x=e.settings)==null?void 0:x.project_branding),f=u==null?void 0:u.brandColor;if(!r)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=r.groups??[],g=[];for(const b of p){const k=b.name||"Root fields";for(const $ of b.fields??[]){const F=$.possible_values,j=F==null?void 0:F.map(S=>({api_value:S.api_value??S.value??"",internal_unique_value:S.internal_unique_value??S.api_value??"",label:S.label??S.name??S.api_value??""}));g.push({key:$.key??$.ckey,label:$.title??$.label??$.key??"",type:$.type??"text",slug:$.slug,ckey:$.ckey,possible_values:j,group:k,regionalVariantsGroupUuid:$.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function ue(t){return t.toLocaleDateString("en-CA")}function We(){return ue(new Date)}function os(t){const e=new Date;switch(t){case"today":return{from:We(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:ue(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:We(),to:ue(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:ue(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:We(),to:ue(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:ue(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:We(),to:ue(s)}}default:return null}}function Gt(t,e){return e?e.type==="date"?na(e):e.type==="string"?la(e):!0:!1}function na(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function la(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function ca(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Gt(i,a))continue;const r=pa(i,a);s.push(...r)}for(const[i,a]of Object.entries(e)){if(!a||!Gt(i,a))continue;const r=ma(i,a);s.push(...r)}return da(s)}function da(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function pa(t,e){if(e.type==="date")return ns(t,e);if(t===m.IMAGE)return fa(e);const s=e,{operator:i=ss,values:a=[],logic:r}=s;if(a.length===0)return[];switch(t){case m.SIZE:return ha(t,a,"..");case m.FACES:return ua(t,i,a);case m.TAGS:return fe(t,i,Xt(a),",",r);case m.LABELS:return fe(t,i,Xt(a),",",r);case m.COLOR:return ga(i,a,r);case m.TYPE:return Yt(t,a,i);case m.MIME_TYPE:return Yt(t,a,i);case m.PRODUCT_REF:return fe(t,"=%",a,",",r);default:return fe(t,i,a,",",r)}}function ns(t,e){const s=e.field||"created";if(e.kind===Ie.PRESET&&e.preset){if(e.preset===qt.EMPTY)return[`${s}:"empty"`];if(e.preset===qt.NOT_EMPTY)return[`${s}:"non-empty"`];const i=os(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===Ie.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===Ie.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===Ie.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===Ie.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function ha(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function ua(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function fe(t,e,s,i,a){if(s.length===0)return[];if(a===Hs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${r}`]}function ga(t,e,s){const i=[],a=fe("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Yt(t,e,s,i){if(e.length===0)return[];const a=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${a}`]}function fa(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,c=n.resolution,d=n.orientation,h=n.faces;return c!=null&&c.length&&e.push(`resolution:"${c.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,i=s[vt.RESOLUTION],a=s[vt.ORIENTATION],r=s[vt.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),r&&e.push(`faces:"${r}"`),e}function ma(t,e){const s=_a(t),i=ba(t);if(e.type==="date")return va(s,e,i);const a=e,{operator:r=ss,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===U||n[0]===B)){const h=d===_.GEO_POINT?y.IS+"~":y.IS;return[`${s}${h}"${n[0]}"`]}if((d===_.NUMERIC||d===_.DECIMAL2)&&r===y.RANGE)return[`${s}${y.IS}"${n.join('","')}"`];if(d===_.GEO_POINT){const h=n.map(u=>{const f=u.indexOf("..");if(f===-1)return`(${u})`;const p=u.slice(0,f),g=u.slice(f);return`(${p})${g}`});return fe(s,r+"~",h,",",c)}return fe(s,r,n,",",c)}function va(t,e,s){const i=ns(t,e);return!s||i.length===0?i:i.map(a=>{const r=a.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${a}"`;const n=a.slice(0,r),d=a.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function ba(t){return t.startsWith("date_")}function _a(t){for(const e of Jt)if(t.startsWith(e))return t.slice(e.length);return t}function Xt(t){return t.map(e=>e.replace(/#/g,""))}const ya=new Set([m.DATE,m.LICENSE_EXPIRY,z.DUE_DATE]);function De(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=xa(s,i));return e}function xa(t,e){return e.type==="string"||e.type==="date"?e:ya.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function wa(t){const e=localStorage.getItem(es+t),s=localStorage.getItem(ts+t);let i;try{i=e?JSON.parse(e):[...Ht]}catch{i=[...Ht]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function $a(t,e){localStorage.setItem(es+t,JSON.stringify(e))}function ka(t,e){localStorage.setItem(ts+t,JSON.stringify(e))}const ls="sort-by",cs="sort-order";function Wt(t,e){try{localStorage.setItem(ls,t),localStorage.setItem(cs,e)}catch{}}function Sa(){try{const t=localStorage.getItem(ls),e=localStorage.getItem(cs);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const ds="ap-last-folder",ps="ap-last-view",hs="ap-last-tab";function Qt(t){try{localStorage.setItem(ds,t)}catch{}}function Ca(){try{return localStorage.getItem(ds)}catch{return null}}function Ea(t){try{localStorage.setItem(ps,t)}catch{}}function Fa(){try{return localStorage.getItem(ps)}catch{return null}}function Aa(t){try{localStorage.setItem(hs,t)}catch{}}function Ta(){try{const t=localStorage.getItem(hs);return t==="assets"||t==="folders"?t:null}catch{return null}}function Ma(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,i=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,r=parseInt(s.slice(4,6),16)/255;return[i,a,r]}function wt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Oa(t,e,s){const i=wt(t),a=wt(e),r=wt(s),n=.4122214708*i+.5363325363*a+.0514459929*r,c=.2119034982*i+.6806995451*a+.1073969566*r,d=.0883024619*i+.2817188376*a+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(c),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,v=.0259040371*h+.7827717662*u-.808675766*f,x=Math.sqrt(g*g+v*v);let b=Math.atan2(v,g)*(180/Math.PI);return b<0&&(b+=360),[p,x,b]}function La(t){return t>.7}function Pa(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const f of s)t.style.removeProperty(f);return}const[i,a,r]=Ma(e),[n,c,d]=Oa(i,a,r),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=La(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const At=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],Ia=[{value:"relevance",label:"Relevance"},...At],Da=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}];var za=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Tt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ra(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&za(e,s,a),a};let Re=class extends o.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return o.html`
1
+ "use strict";var Ts=Object.create;var qt=Object.defineProperty;var Ms=Object.getOwnPropertyDescriptor;var Ls=Object.getOwnPropertyNames;var Os=Object.getPrototypeOf,Ps=Object.prototype.hasOwnProperty;var Is=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ls(e))!Ps.call(t,a)&&a!==s&&qt(t,a,{get:()=>e[a],enumerable:!(i=Ms(e,a))||i.enumerable});return t};var Ds=(t,e,s)=>(s=t!=null?Ts(Os(t)):{},Is(e||!t||!t.__esModule?qt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),c=require("lit/decorators.js");class zs{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Rs(){return new zs({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1})}class Ns{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function js(t){return"extension"in t&&!("path"in t)}class Bs{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}get _folderSelectionEnabled(){var e;return((e=this.store.getState().config)==null?void 0:e.folderSelection)===!0}_getCombinedList(){const e=this.store.getState();return this._folderSelectionEnabled?[...e.folders,...e.assets]:e.assets}_applyRangeSelection(e,s,i,a){const r=this._getCombinedList();for(let n=e;n<=s;n++){const l=r[n];l&&(js(l)?i.set(l.uuid,l):a.set(l.uuid,l))}}handleSelect(e,s,i){var l,d,h,u;const a=this.store.getState(),r=new Map(a.selectedAssets);if(!(((l=a.config)==null?void 0:l.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r,selectedFolders:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0)if(this._folderSelectionEnabled){const f=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),g=new Map(a.selectedFolders);this._applyRangeSelection(f,p,r,g);const m=(d=a.config)==null?void 0:d.maxSelections;if(m&&r.size+g.size>m)return;this.store.setState({selectedAssets:r,selectedFolders:g})}else{const f=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),g=a.assets;for(let y=f;y<=p;y++)g[y]&&r.set(g[y].uuid,g[y]);const m=(h=a.config)==null?void 0:h.maxSelections;if(m&&r.size>m)return;this.store.setState({selectedAssets:r})}else if(i.metaKey||i.ctrlKey){r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e);const f=(u=a.config)==null?void 0:u.maxSelections,p=r.size+(this._folderSelectionEnabled?a.selectedFolders.size:0);if(f&&p>f)return;this.store.setState({selectedAssets:r})}else r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r,selectedFolders:new Map});this.lastClickedIndex=s}handleFolderSelect(e,s,i){var l,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),r=new Map(a.selectedFolders);if(!(((l=a.config)==null?void 0:l.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedFolders:r,selectedAssets:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=new Map(a.selectedAssets);this._applyRangeSelection(u,f,p,r);const g=(d=a.config)==null?void 0:d.maxSelections;if(g&&p.size+r.size>g)return;this.store.setState({selectedAssets:p,selectedFolders:r})}else if(i.metaKey||i.ctrlKey){r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e);const u=(h=a.config)==null?void 0:h.maxSelections,f=r.size+a.selectedAssets.size;if(u&&f>u)return;this.store.setState({selectedFolders:r})}else r.clear(),r.set(e.uuid,e),this.store.setState({selectedFolders:r,selectedAssets:new Map});this.lastClickedIndex=s}isSelected(e){return this.store.getState().selectedAssets.has(e)}isFolderSelected(e){return this.store.getState().selectedFolders.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var l;const s=this.store.getState(),i=(l=s.config)==null?void 0:l.maxSelections,a=this._folderSelectionEnabled?s.selectedFolders.size:0,r=new Map,n=i?Math.max(0,Math.min(e.length,i-a)):e.length;for(let d=0;d<n;d++)r.set(e[d].uuid,e[d]);return this.store.setState({selectedAssets:r}),this.lastClickedIndex=-1,r.size}selectAllFolders(e){var n;if(!this._folderSelectionEnabled)return;const s=this.store.getState(),i=(n=s.config)==null?void 0:n.maxSelections,a=new Map,r=i?Math.max(0,Math.min(e.length,i-s.selectedAssets.size)):e.length;for(let l=0;l<r;l++)a.set(e[l].uuid,e[l]);this.store.setState({selectedFolders:a})}clearSelection(){this.store.setState({selectedAssets:new Map,selectedFolders:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}getSelectedFolders(){return Array.from(this.store.getState().selectedFolders.values())}}class Us{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(i=>{var a;(a=i[0])!=null&&a.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const Ht=5,Ae=40,Kt=15;class Vs{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this.preMarqueeFolderSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=i=>this.onMouseDown(i),this.handleMouseMove=i=>this.onMouseMove(i),this.handleMouseUp=()=>this.onMouseUp(),this.preventSelect=i=>i.preventDefault(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(i=>{if(!(i instanceof HTMLElement))return!1;if(i instanceof HTMLButtonElement||i instanceof HTMLInputElement)return!0;const a=i.tagName.toLowerCase();return!!(a.startsWith("ap-asset-")||a.startsWith("ap-folder-")||i.classList.contains("check")||i.classList.contains("check-box"))})}onMouseDown(e){if(e.button!==0||this.isInteractiveTarget(e))return;const s=this.container.getBoundingClientRect();this.startX=e.clientX-s.left+this.container.scrollLeft,this.startY=e.clientY-s.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){var s;if(this.container){if(!this._dragging){const i=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(i<Ht&&a<Ht)return;this._dragging=!0,this.isActive=!0,document.addEventListener("selectstart",this.preventSelect),(s=window.getSelection())==null||s.removeAllRanges(),this.preMarqueeSelection=new Map(this.store.getState().selectedAssets),this.preMarqueeFolderSelection=new Map(this.store.getState().selectedFolders)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientX-s.left+this.container.scrollLeft,a=e.clientY-s.top+this.container.scrollTop;let r=Math.min(this.startX,i),n=Math.min(this.startY,a),l=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;r+l>h&&(l=h-r),n+d>u&&(d=u-n),r<0&&(l+=r,r=0),n<0&&(d+=n,n=0),this.rect={x:r,y:n,width:l,height:d},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;if(this.container.scrollHeight<=this.container.clientHeight){this.stopAutoScroll();return}const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,r=i<Ae||a<Ae;r&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):r||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent||this.container.scrollHeight<=this.container.clientHeight)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let r=0;i<Ae?r=-Kt*(1-i/Ae):a<Ae&&(r=Kt*(1-a/Ae)),r!==0&&(this.container.scrollTop+=r,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}querySelectableElements(){const e=[],s=[];for(const i of Array.from(this.container.children))if(i.shadowRoot){const a=i.shadowRoot.querySelectorAll("[data-asset-uuid]");a.length>0&&e.push(...Array.from(a));const r=i.shadowRoot.querySelectorAll("[data-folder-uuid]");r.length>0&&s.push(...Array.from(r))}return e.length===0&&e.push(...Array.from(this.container.querySelectorAll("[data-asset-uuid]"))),s.length===0&&s.push(...Array.from(this.container.querySelectorAll("[data-folder-uuid]"))),{assetCards:e,folderCards:s}}getCardRelativeRect(e){const s=e.getBoundingClientRect(),i=this.container.getBoundingClientRect();return{x:s.left-i.left+this.container.scrollLeft,y:s.top-i.top+this.container.scrollTop,width:s.width,height:s.height}}intersectsMarquee(e){return this.rect.x<e.x+e.width&&this.rect.x+this.rect.width>e.x&&this.rect.y<e.y+e.height&&this.rect.y+this.rect.height>e.y}selectIntersecting(){var h,u;if(!this.container)return;const e=this.store.getState(),s=((h=e.config)==null?void 0:h.folderSelection)===!0,{assetCards:i,folderCards:a}=this.querySelectableElements(),r=new Map(this.preMarqueeSelection),n=s?new Map(this.preMarqueeFolderSelection):e.selectedFolders;i.forEach(f=>{const p=this.getCardRelativeRect(f),g=f.dataset.assetUuid;if(this.intersectsMarquee(p)){const m=e.assets.find(y=>y.uuid===g);m&&r.set(g,m)}}),s&&a.forEach(f=>{const p=this.getCardRelativeRect(f),g=f.dataset.folderUuid;if(this.intersectsMarquee(p)){const m=e.folders.find(y=>y.uuid===g);m&&n.set(g,m)}});const l=(u=e.config)==null?void 0:u.maxSelections,d=r.size+(s?n.size:0);if(l&&d>l){const f=Array.from(r.entries()).slice(0,Math.max(0,l-n.size));this.store.setState({selectedAssets:new Map(f),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:r,...s?{selectedFolders:n}:{}})}}class qs{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`,e.mode==="sassKey"&&(this.sassKey=e.sassKey)}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}_applyAuthHeaders(e){this.sassKey?e["X-Filerobot-Key"]=this.sassKey:this.auth.mode==="securityTemplate"&&(e["X-Filerobot-Key"]=this.auth.securityTemplateKey)}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([l,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(l,d.join(",")):i.searchParams.set(l,String(d)))});const a={};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(i.toString(),{headers:a,signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}}function Hs(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",i=t.sort_direction??"desc",a={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${a[s]||s}:${i}`,t.folder&&(e.folder=t.folder);const r=[];return t.search&&r.push(t.search),t.q&&r.push(t.q),r.length>0&&(e.q=r.join(" ")),e}async function Ve(t,e){const s=Hs(e);return t.request("/files",s)}async function Gt(t,e){const s={folder:e.folder,recursive:e.recursive??1},i=[];return e.search&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),t.request("/files/stats",s)}async function Ks(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const i=(e==null?void 0:e.sort_by)??"created_at",a=(e==null?void 0:e.sort_direction)??"asc",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[i]||i}:${a}`,await t.request("/folders",s)}async function Gs(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Ys(t){return await t.request("/labels")}async function Xs(t){return((await t.request("/tags")).tags||[]).map(i=>({...i,label:i.names.en||Object.values(i.names)[0]||""})).filter(i=>i.label).sort((i,a)=>i.label.localeCompare(a.label))}async function Ws(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}const v={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},R={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},w={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},Qs={AND:"AND"},_={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},ft={[_.DATE]:"date_",[_.BOOLEAN]:"bool_",[_.NUMERIC]:"num_",[_.DECIMAL2]:"dec_",[_.ATTACHMENTS_ASSETS]:"attach_",[_.ATTACHMENT_URI]:"uri_",[_.SELECT_ONE]:"one_",[_.MULTI_SELECT]:"multi_",[_.SUPERTAGS]:"tags_",[_.TEXT]:"text_",[_.TEXT_AREA]:"area_",[_.GEO_POINT]:"geo_",[_.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(ft).map(([t,e])=>[e,t]));const as=Object.values(ft),qe={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Yt={EMPTY:"empty",NOT_EMPTY:"non-empty"},U="empty",V="non-empty",me="specific",wt=10,$t=10,st=10,rs="filters:pinned:",os="metadata:pinned:",Xt=[v.DATE,v.TYPE,v.SIZE],ns=w.IS,at="20",rt="1",Zs=0,Js=[{key:v.DATE,label:"Date",icon:"calendar",type:"date"},{key:v.TYPE,label:"Format",icon:"file-type",type:"string"},{key:v.SIZE,label:"Size",icon:"scaling",type:"string"},{key:v.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:v.TAGS,label:"Tags",icon:"hash",type:"string"},{key:v.LABELS,label:"Labels",icon:"tag",type:"string"},{key:v.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:v.IMAGE,label:"Image",icon:"image",type:"string"},{key:v.COLOR,label:"Color",icon:"swatch-book",type:"string"}],ei={key:v.METADATA,label:"Metadata",icon:"file-text",type:"string"},ti={key:v.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},Lt=[ei,...Js,ti],Te={[v.TYPE]:"Format",[v.DATE]:"Date",[v.SIZE]:"Size",[v.LICENSE_EXPIRY]:"License expiry",[v.TAGS]:"Tags",[v.LABELS]:"Labels",[v.PRODUCT_REF]:"Products",[v.IMAGE]:"Image",[v.COLOR]:"Color",[v.METADATA]:"Metadata",[v.APPROVAL]:"Approval"},ne={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},ls=[{value:ne.IMAGE,label:"Image",icon:"image"},{value:ne.VIDEO,label:"Video",icon:"clapperboard"},{value:ne.AUDIO,label:"Audio",icon:"music"},{value:ne.DOCUMENT,label:"Document",icon:"document"},{value:ne.ARCHIVE,label:"Archive",icon:"archive"},{value:ne.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:ne.FONTS,label:"Fonts",icon:"text"},{value:ne.OTHER,label:"Other",icon:"layout-grid"}],kt={RESOLUTION:0,ORIENTATION:1,FACES:2},si=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],ii=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],ai=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],cs=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],Pt=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],ds=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],ri=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],oi=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],ni=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],St=[{label:"Is",value:w.IS},{label:"Contains",value:w.CONTAINS_IN_TEXT}],ee=[{label:"Is",value:w.IS},{label:"Is not",value:w.IS_NOT}],Ct=[{label:"Is",value:w.IS_EXACT},{label:"Contains",value:w.IS},{label:"Does not contain",value:w.IS_NOT}],Et=[{label:"Is",value:w.IS},{label:"Greater than",value:w.GREATER_THAN_OR_EQUAL},{label:"Is not",value:w.IS_NOT},{label:"Less than",value:w.LESS_THAN_OR_EQUAL},{label:"Between",value:w.RANGE}],li=[{label:"Is",value:w.IS_EXACT},{label:"Is not",value:w.IS_NOT}],Wt=[{label:"Contains",value:w.CONTAINS},{label:"Does not contain",value:w.IS_NOT}],ci=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],be=[{label:"Empty",value:U},{label:"Not empty",value:V}],Ft=[...be,{label:"Specific",value:me}],di=[{label:"Empty",value:U},{label:"Not empty",value:V},{label:"True",value:"true"},{label:"False",value:"false"}],ot={[_.DATE]:"calendar",[_.BOOLEAN]:"toggle-left",[_.NUMERIC]:"file-digit",[_.DECIMAL2]:"decimals-arrow-right",[_.ATTACHMENTS_ASSETS]:"paperclip",[_.ATTACHMENT_URI]:"link-2",[_.SELECT_ONE]:"circle-dot",[_.MULTI_SELECT]:"square-check",[_.SUPERTAGS]:"hash",[_.TEXT]:"text-initial",[_.TEXT_AREA]:"text-align-justify",[_.GEO_POINT]:"locate",[_.INTEGER_LIST]:"list-ordered"},pi={[_.TEXT]:"text",[_.TEXT_AREA]:"text",[_.NUMERIC]:"number",[_.DECIMAL2]:"number",[_.BOOLEAN]:"boolean",[_.SELECT_ONE]:"select-one",[_.MULTI_SELECT]:"multi-select",[_.SUPERTAGS]:"tags",[_.DATE]:"date",[_.GEO_POINT]:"geo",[_.ATTACHMENTS_ASSETS]:"attachment",[_.ATTACHMENT_URI]:"attachment",[_.INTEGER_LIST]:"attachment"};async function hi(t){var m,y;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,r=((i==null?void 0:i.model)??[])[Zs],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(x=>({uuid:x.uuid,label:x.label??x.name??"",variants:(x.variants??[]).map(S=>({api_value:S.api_value??S.value??"",internal_unique_value:S.internal_unique_value??S.api_value??"",label:S.label??S.name??""}))})).filter(x=>x.variants.length>1),h={};for(const x of d)h[x.uuid]=((m=x.variants[0])==null?void 0:m.api_value)??"";const u=(s==null?void 0:s.project_branding)??((y=e.settings)==null?void 0:y.project_branding),f=u==null?void 0:u.brandColor;if(!r)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=r.groups??[],g=[];for(const x of p){const S=x.name||"Root fields";for(const b of x.fields??[]){const C=b.possible_values,T=C==null?void 0:C.map($=>({api_value:$.api_value??$.value??"",internal_unique_value:$.internal_unique_value??$.api_value??"",label:$.label??$.name??$.api_value??""}));g.push({key:b.key??b.ckey,label:b.title??b.label??b.key??"",type:b.type??"text",slug:b.slug,ckey:b.ckey,possible_values:T,group:S,regionalVariantsGroupUuid:b.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function ve(t){return t.toLocaleDateString("en-CA")}function it(){return ve(new Date)}function ps(t){const e=new Date;switch(t){case"today":return{from:it(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:ve(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:it(),to:ve(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:ve(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:it(),to:ve(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:ve(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:it(),to:ve(s)}}default:return null}}function Qt(t,e){return e?e.type==="date"?ui(e):e.type==="string"?gi(e):!0:!1}function ui(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function gi(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function fi(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Qt(i,a))continue;const r=vi(i,a);s.push(...r)}for(const[i,a]of Object.entries(e)){if(!a||!Qt(i,a))continue;const r=wi(i,a);s.push(...r)}return mi(s)}function mi(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function vi(t,e){if(e.type==="date")return hs(t,e);if(t===v.IMAGE)return xi(e);const s=e,{operator:i=ns,values:a=[],logic:r}=s;if(a.length===0)return[];switch(t){case v.SIZE:return bi(t,a,"..");case v.FACES:return _i(t,i,a);case v.TAGS:return _e(t,i,Jt(a),",",r);case v.LABELS:return _e(t,i,Jt(a),",",r);case v.COLOR:return yi(i,a,r);case v.TYPE:return Zt(t,a,i);case v.MIME_TYPE:return Zt(t,a,i);case v.PRODUCT_REF:return _e(t,"=%",a,",",r);default:return _e(t,i,a,",",r)}}function hs(t,e){const s=e.field||"created";if(e.kind===qe.PRESET&&e.preset){if(e.preset===Yt.EMPTY)return[`${s}:"empty"`];if(e.preset===Yt.NOT_EMPTY)return[`${s}:"non-empty"`];const i=ps(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===qe.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===qe.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===qe.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===qe.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function bi(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function _i(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function _e(t,e,s,i,a){if(s.length===0)return[];if(a===Qs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${r}`]}function yi(t,e,s){const i=[],a=_e("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Zt(t,e,s,i){if(e.length===0)return[];const a=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${a}`]}function xi(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,l=n.resolution,d=n.orientation,h=n.faces;return l!=null&&l.length&&e.push(`resolution:"${l.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,i=s[kt.RESOLUTION],a=s[kt.ORIENTATION],r=s[kt.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),r&&e.push(`faces:"${r}"`),e}function wi(t,e){const s=Si(t),i=ki(t);if(e.type==="date")return $i(s,e,i);const a=e,{operator:r=ns,values:n=[],logic:l,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===U||n[0]===V)){const h=d===_.GEO_POINT?w.IS+"~":w.IS;return[`${s}${h}"${n[0]}"`]}if((d===_.NUMERIC||d===_.DECIMAL2)&&r===w.RANGE)return[`${s}${w.IS}"${n.join('","')}"`];if(d===_.GEO_POINT){const h=n.map(u=>{const f=u.indexOf("..");if(f===-1)return`(${u})`;const p=u.slice(0,f),g=u.slice(f);return`(${p})${g}`});return _e(s,r+"~",h,",",l)}return _e(s,r,n,",",l)}function $i(t,e,s){const i=hs(t,e);return!s||i.length===0?i:i.map(a=>{const r=a.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${a}"`;const n=a.slice(0,r),d=a.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function ki(t){return t.startsWith("date_")}function Si(t){for(const e of as)if(t.startsWith(e))return t.slice(e.length);return t}function Jt(t){return t.map(e=>e.replace(/#/g,""))}const Ci=new Set([v.DATE,v.LICENSE_EXPIRY,R.DUE_DATE]);function He(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Ei(s,i));return e}function Ei(t,e){return e.type==="string"||e.type==="date"?e:Ci.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function Fi(t){const e=localStorage.getItem(rs+t),s=localStorage.getItem(os+t);let i;try{i=e?JSON.parse(e):[...Xt]}catch{i=[...Xt]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function Ai(t,e){localStorage.setItem(rs+t,JSON.stringify(e))}function Ti(t,e){localStorage.setItem(os+t,JSON.stringify(e))}const us="sort-by",gs="sort-order";function es(t,e){try{localStorage.setItem(us,t),localStorage.setItem(gs,e)}catch{}}function Mi(){try{const t=localStorage.getItem(us),e=localStorage.getItem(gs);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const fs="ap-last-folder",ms="ap-last-view",vs="ap-last-tab";function ts(t){try{localStorage.setItem(fs,t)}catch{}}function ss(){try{return localStorage.getItem(fs)}catch{return null}}function Li(t){try{localStorage.setItem(ms,t)}catch{}}function Oi(){try{return localStorage.getItem(ms)}catch{return null}}function Pi(t){try{localStorage.setItem(vs,t)}catch{}}function Ii(){try{const t=localStorage.getItem(vs);return t==="assets"||t==="folders"?t:null}catch{return null}}function Di(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,i=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,r=parseInt(s.slice(4,6),16)/255;return[i,a,r]}function At(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function zi(t,e,s){const i=At(t),a=At(e),r=At(s),n=.4122214708*i+.5363325363*a+.0514459929*r,l=.2119034982*i+.6806995451*a+.1073969566*r,d=.0883024619*i+.2817188376*a+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(l),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,m=.0259040371*h+.7827717662*u-.808675766*f,y=Math.sqrt(g*g+m*m);let x=Math.atan2(m,g)*(180/Math.PI);return x<0&&(x+=360),[p,y,x]}function Ri(t){return t>.7}function Ni(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const f of s)t.style.removeProperty(f);return}const[i,a,r]=Di(e),[n,l,d]=zi(i,a,r),h=`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)})`,u=Ri(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const It=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],ji=[{value:"relevance",label:"Relevance"},...It],Bi=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}];var Ui=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,Dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Vi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ui(e,s,a),a};let Ge=class extends o.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return o.html`
2
2
  <dialog
3
3
  @click=${this._handleBackdropClick}
4
4
  @cancel=${this._handleCancel}
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  </div>
17
17
  </dialog>
18
- `}};Re.styles=o.css`
18
+ `}};Ge.styles=o.css`
19
19
  :host {
20
20
  display: contents;
21
21
  }
@@ -88,11 +88,11 @@
88
88
  animation: none;
89
89
  }
90
90
  }
91
- `;Tt([l.property({type:Boolean})],Re.prototype,"open",2);Tt([l.query("dialog")],Re.prototype,"dialog",2);Re=Tt([l.customElement("ap-modal")],Re);function Na(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const J=o.css`
91
+ `;Dt([c.property({type:Boolean})],Ge.prototype,"open",2);Dt([c.query("dialog")],Ge.prototype,"dialog",2);Ge=Dt([c.customElement("ap-modal")],Ge);function qi(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const W=o.css`
92
92
  *, *::before, *::after {
93
93
  box-sizing: border-box;
94
94
  }
95
- `;var ja=Object.defineProperty,Ua=Object.getOwnPropertyDescriptor,pt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ua(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ja(e,s,a),a};let Ce=class extends o.LitElement{constructor(){super(...arguments),this.groups=[],this.selectedFilters={},this._open=!1,this._handleOutsideClick=t=>{this._open&&!t.composedPath().includes(this)&&(this._open=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_selectVariant(t,e){this.dispatchEvent(new CustomEvent("regional-change",{detail:{groupUuid:t,value:e},bubbles:!0,composed:!0}))}render(){const t=this.groups.length>0;return o.html`
95
+ `;var Hi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,mt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ki(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Hi(e,s,a),a};let Le=class extends o.LitElement{constructor(){super(...arguments),this.groups=[],this.selectedFilters={},this._open=!1,this._handleOutsideClick=t=>{this._open&&!t.composedPath().includes(this)&&(this._open=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_selectVariant(t,e){this.dispatchEvent(new CustomEvent("regional-change",{detail:{groupUuid:t,value:e},bubbles:!0,composed:!0}))}render(){const t=this.groups.length>0;return o.html`
96
96
  <button
97
97
  class="trigger ${this._open?"active":""}"
98
98
  @click=${()=>this._open=!this._open}
@@ -123,7 +123,7 @@
123
123
  </div>
124
124
  `)}
125
125
  </div>
126
- `}};Ce.styles=o.css`
126
+ `}};Le.styles=o.css`
127
127
  :host {
128
128
  position: relative;
129
129
  display: inline-block;
@@ -208,7 +208,7 @@
208
208
  width: 16px;
209
209
  flex-shrink: 0;
210
210
  }
211
- `;pt([l.property({type:Array})],Ce.prototype,"groups",2);pt([l.property({type:Object})],Ce.prototype,"selectedFilters",2);pt([l.state()],Ce.prototype,"_open",2);Ce=pt([l.customElement("ap-regional-settings")],Ce);var Ba=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?Va(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ba(e,s,a),a};const qa=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"}];let H=class extends o.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this._localSearch="",this._debouncedSearch=Na(t=>{(t.length===0||t.length>=3)&&this.dispatchEvent(new CustomEvent("search-change",{detail:{value:t},bubbles:!0,composed:!0}))},300)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedSearch.cancel()}willUpdate(t){t.has("searchQuery")&&(this._localSearch=this.searchQuery)}_handleInput(t){const e=t.target.value;this._localSearch=e,this._debouncedSearch(e)}_clearSearch(){this._localSearch="",this._debouncedSearch.cancel(),this.dispatchEvent(new CustomEvent("search-change",{detail:{value:""},bubbles:!0,composed:!0}))}_toggleView(){const t=this.viewMode==="grid"?"list":"grid";this.dispatchEvent(new CustomEvent("view-change",{detail:{mode:t},bubbles:!0,composed:!0}))}_handleTabChange(t){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:t.detail.value},bubbles:!0,composed:!0}))}_handleRegionalChange(t){this.dispatchEvent(new CustomEvent("regional-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=qa.filter(i=>this.tabs.includes(i.value));return((e=t.find(i=>i.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),o.html`
211
+ `;mt([c.property({type:Array})],Le.prototype,"groups",2);mt([c.property({type:Object})],Le.prototype,"selectedFilters",2);mt([c.state()],Le.prototype,"_open",2);Le=mt([c.customElement("ap-regional-settings")],Le);var Gi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,re=(t,e,s,i)=>{for(var a=i>1?void 0:i?Yi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Gi(e,s,a),a};const Xi=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"}];let Y=class extends o.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this._localSearch="",this._debouncedSearch=qi(t=>{(t.length===0||t.length>=3)&&this.dispatchEvent(new CustomEvent("search-change",{detail:{value:t},bubbles:!0,composed:!0}))},300)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedSearch.cancel()}willUpdate(t){t.has("searchQuery")&&(this._localSearch=this.searchQuery)}_handleInput(t){const e=t.target.value;this._localSearch=e,this._debouncedSearch(e)}_clearSearch(){this._localSearch="",this._debouncedSearch.cancel(),this.dispatchEvent(new CustomEvent("search-change",{detail:{value:""},bubbles:!0,composed:!0}))}_toggleView(){const t=this.viewMode==="grid"?"list":"grid";this.dispatchEvent(new CustomEvent("view-change",{detail:{mode:t},bubbles:!0,composed:!0}))}_handleTabChange(t){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:t.detail.value},bubbles:!0,composed:!0}))}_handleRegionalChange(t){this.dispatchEvent(new CustomEvent("regional-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=Xi.filter(i=>this.tabs.includes(i.value));return((e=t.find(i=>i.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),o.html`
212
212
  <div class="header-row">
213
213
  ${t.length>1?o.html`<ap-dropdown
214
214
  .value=${this.activeTab}
@@ -219,7 +219,7 @@
219
219
  <ap-icon class="search-icon" name="search" .size=${16}></ap-icon>
220
220
  <input
221
221
  type="text"
222
- placeholder="Search assets"
222
+ placeholder=${this.activeTab==="folders"?"Search folders and assets":"Search assets"}
223
223
  .value=${this.searchQuery}
224
224
  @input=${this._handleInput}
225
225
  />
@@ -251,7 +251,7 @@
251
251
  `}
252
252
  </div>
253
253
  </div>
254
- `}};H.styles=[J,o.css`
254
+ `}};Y.styles=[W,o.css`
255
255
  :host {
256
256
  display: block;
257
257
  padding: 16px 20px;
@@ -264,6 +264,7 @@
264
264
  }
265
265
  .search-wrapper {
266
266
  flex: 1;
267
+ min-width: 0;
267
268
  max-width: 548px;
268
269
  position: relative;
269
270
  }
@@ -361,7 +362,7 @@
361
362
  height: 24px;
362
363
  background: var(--ap-border, oklch(92.86% 0.009 247.92));
363
364
  }
364
- `];ee([l.property()],H.prototype,"activeTab",2);ee([l.property({type:Array})],H.prototype,"tabs",2);ee([l.property()],H.prototype,"viewMode",2);ee([l.property()],H.prototype,"searchQuery",2);ee([l.property({type:Array})],H.prototype,"regionalGroups",2);ee([l.property({type:Object})],H.prototype,"regionalFilters",2);ee([l.property({type:Boolean})],H.prototype,"hideClose",2);ee([l.state()],H.prototype,"_localSearch",2);H=ee([l.customElement("ap-header")],H);var Ha=Object.defineProperty,Ka=Object.getOwnPropertyDescriptor,us=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ka(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ha(e,s,a),a};let et=class extends o.LitElement{constructor(){super(...arguments),this.items=[]}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?o.html``:o.html`
365
+ `];re([c.property()],Y.prototype,"activeTab",2);re([c.property({type:Array})],Y.prototype,"tabs",2);re([c.property()],Y.prototype,"viewMode",2);re([c.property()],Y.prototype,"searchQuery",2);re([c.property({type:Array})],Y.prototype,"regionalGroups",2);re([c.property({type:Object})],Y.prototype,"regionalFilters",2);re([c.property({type:Boolean})],Y.prototype,"hideClose",2);re([c.state()],Y.prototype,"_localSearch",2);Y=re([c.customElement("ap-header")],Y);var Wi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,bs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Qi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Wi(e,s,a),a};let nt=class extends o.LitElement{constructor(){super(...arguments),this.items=[]}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?o.html``:o.html`
365
366
  <nav class="breadcrumb" aria-label="Breadcrumb">
366
367
  <button @click=${()=>this._navigate("")}>Root</button>
367
368
  ${this.items.map((t,e)=>o.html`
@@ -369,7 +370,7 @@
369
370
  ${e<this.items.length-1?o.html`<button @click=${()=>this._navigate(t.uuid)}>${t.name}</button>`:o.html`<span class="current">${t.name}</span>`}
370
371
  `)}
371
372
  </nav>
372
- `}};et.styles=o.css`
373
+ `}};nt.styles=o.css`
373
374
  :host {
374
375
  display: block;
375
376
  padding: 4px 20px 12px;
@@ -405,12 +406,12 @@
405
406
  ap-icon {
406
407
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
407
408
  }
408
- `;us([l.property({type:Array})],et.prototype,"items",2);et=us([l.customElement("ap-breadcrumb")],et);var Ga=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,Mt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ya(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ga(e,s,a),a};let Ne=class extends o.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?o.html`
409
+ `;bs([c.property({type:Array})],nt.prototype,"items",2);nt=bs([c.customElement("ap-breadcrumb")],nt);var Zi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,zt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zi(e,s,a),a};let Ye=class extends o.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?o.html`
409
410
  <div class="popover">
410
411
  ${this.title?o.html`<div class="title">${this.title}</div>`:""}
411
412
  <slot></slot>
412
413
  </div>
413
- `:o.html``}};Ne.styles=o.css`
414
+ `:o.html``}};Ye.styles=o.css`
414
415
  :host {
415
416
  display: block;
416
417
  }
@@ -435,10 +436,10 @@
435
436
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
436
437
  margin-bottom: 12px;
437
438
  }
438
- `;Mt([l.property()],Ne.prototype,"title",2);Mt([l.property({type:Boolean})],Ne.prototype,"open",2);Ne=Mt([l.customElement("ap-filter-popover")],Ne);var Xa=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,gs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Xa(e,s,a),a};let tt=class extends o.LitElement{constructor(){super(...arguments),this.selected=[]}_toggle(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.TYPE,values:e,operator:y.IS},bubbles:!0,composed:!0}))}render(){return o.html`
439
+ `;zt([c.property()],Ye.prototype,"title",2);zt([c.property({type:Boolean})],Ye.prototype,"open",2);Ye=zt([c.customElement("ap-filter-popover")],Ye);var ea=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,_s=(t,e,s,i)=>{for(var a=i>1?void 0:i?ta(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ea(e,s,a),a};let lt=class extends o.LitElement{constructor(){super(...arguments),this.selected=[]}_toggle(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.TYPE,values:e,operator:w.IS},bubbles:!0,composed:!0}))}render(){return o.html`
439
440
  <div class="options">
440
441
  <span class="section-label">Formats</span>
441
- ${as.map(t=>o.html`
442
+ ${ls.map(t=>o.html`
442
443
  <div
443
444
  class="option ${this.selected.includes(t.value)?"selected":""}"
444
445
  @click=${()=>this._toggle(t.value)}
@@ -451,7 +452,7 @@
451
452
  </div>
452
453
  `)}
453
454
  </div>
454
- `}};tt.styles=o.css`
455
+ `}};lt.styles=o.css`
455
456
  :host {
456
457
  display: block;
457
458
  }
@@ -498,7 +499,7 @@
498
499
  .option.selected ap-icon {
499
500
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
500
501
  }
501
- `;gs([l.property({type:Array})],tt.prototype,"selected",2);tt=gs([l.customElement("ap-filter-type")],tt);const te=o.css`
502
+ `;_s([c.property({type:Array})],lt.prototype,"selected",2);lt=_s([c.customElement("ap-filter-type")],lt);const oe=o.css`
502
503
  :host {
503
504
  display: block;
504
505
  }
@@ -781,11 +782,11 @@
781
782
  font-size: var(--ap-font-size-sm, 0.875rem);
782
783
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
783
784
  }
784
- `;var Qa=Object.defineProperty,Za=Object.getOwnPropertyDescriptor,_e=(t,e,s,i)=>{for(var a=i>1?void 0:i?Za(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Qa(e,s,a),a};function $t(t){return t.toISOString().split("T")[0]}let W=class extends o.LitElement{constructor(){super(...arguments),this.filterKey=m.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===m.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?rs:Ft}get _todayStr(){return $t(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=os(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,i=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=i:this.to=i,this.preset==="specific"&&t==="from"&&i){const a=new Date(s+"T23:59:59");this.to=a.toISOString()}this.preset==="after"&&t==="from"&&i&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&i&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?o.nothing:o.html`
785
+ `;var sa=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,ke=(t,e,s,i)=>{for(var a=i>1?void 0:i?ia(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&sa(e,s,a),a};function Tt(t){return t.toISOString().split("T")[0]}let te=class extends o.LitElement{constructor(){super(...arguments),this.filterKey=v.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===v.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?ds:Pt}get _todayStr(){return Tt(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=ps(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,i=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=i:this.to=i,this.preset==="specific"&&t==="from"&&i){const a=new Date(s+"T23:59:59");this.to=a.toISOString()}this.preset==="after"&&t==="from"&&i&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&i&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?o.nothing:o.html`
785
786
  <div class="filter-section">
786
787
  <span class="section-label">Date type</span>
787
788
  <ap-radio-group
788
- .options=${is}
789
+ .options=${cs}
789
790
  .value=${this.field}
790
791
  @ap-change=${t=>this._selectField(t.detail.value)}
791
792
  ></ap-radio-group>
@@ -800,7 +801,7 @@
800
801
  @ap-change=${t=>this._selectPreset(t.detail.value)}
801
802
  ></ap-radio-group>
802
803
  </div>
803
- `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return o.nothing;const e=this.from?$t(new Date(this.from)):"",s=this.to?$t(new Date(this.to)):"",i=this._todayStr;return t==="specific"?o.html`
804
+ `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return o.nothing;const e=this.from?Tt(new Date(this.from)):"",s=this.to?Tt(new Date(this.to)):"",i=this._todayStr;return t==="specific"?o.html`
804
805
  <div class="filter-section date-inputs">
805
806
  <div>
806
807
  <span class="input-label">Date</span>
@@ -876,14 +877,14 @@
876
877
  ${this._renderRangeSection()}
877
878
  ${this._renderDateInputs()}
878
879
  </div>
879
- `}};W.styles=[te,o.css`
880
+ `}};te.styles=[oe,o.css`
880
881
  .date-inputs {
881
882
  margin-top: 4px;
882
883
  }
883
- `];_e([l.property()],W.prototype,"filterKey",2);_e([l.property()],W.prototype,"field",2);_e([l.property()],W.prototype,"kind",2);_e([l.property()],W.prototype,"preset",2);_e([l.property()],W.prototype,"from",2);_e([l.property()],W.prototype,"to",2);W=_e([l.customElement("ap-filter-date")],W);var Ja=Object.defineProperty,ei=Object.getOwnPropertyDescriptor,Me=(t,e,s,i)=>{for(var a=i>1?void 0:i?ei(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ja(e,s,a),a};let ie=class extends o.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=m.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=ft}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:y.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:y.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
884
+ `];ke([c.property()],te.prototype,"filterKey",2);ke([c.property()],te.prototype,"field",2);ke([c.property()],te.prototype,"kind",2);ke([c.property()],te.prototype,"preset",2);ke([c.property()],te.prototype,"from",2);ke([c.property()],te.prototype,"to",2);te=ke([c.customElement("ap-filter-date")],te);var aa=Object.defineProperty,ra=Object.getOwnPropertyDescriptor,Re=(t,e,s,i)=>{for(var a=i>1?void 0:i?ra(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&aa(e,s,a),a};let le=class extends o.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=v.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=wt}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:w.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:w.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:w.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
884
885
  <div
885
886
  class="tag-item ${s?"disabled":""}"
886
- title=${s?`You can select up to ${ft} tags`:o.nothing}
887
+ title=${s?`You can select up to ${wt} tags`:o.nothing}
887
888
  @click=${()=>!s&&this._toggle(t.sid)}
888
889
  >
889
890
  <ap-checkbox ?checked=${e}></ap-checkbox>
@@ -929,7 +930,7 @@
929
930
  ${this._atLimit?o.html`
930
931
  <div class="info-alert">
931
932
  <ap-icon name="info" .size=${14}></ap-icon>
932
- <span>You can select up to ${ft} tags.</span>
933
+ <span>You can select up to ${wt} tags.</span>
933
934
  </div>
934
935
  `:o.nothing}
935
936
  </div>
@@ -985,7 +986,7 @@
985
986
  ${t.length>0?o.html`<div class="separator"></div>`:o.nothing}
986
987
 
987
988
  <div class="hint-message">Find more tags by using search</div>
988
- `}};ie.styles=[J,te,o.css`
989
+ `}};le.styles=[W,oe,o.css`
989
990
  .tag-item {
990
991
  display: flex;
991
992
  align-items: center;
@@ -1069,10 +1070,10 @@
1069
1070
  max-height: none;
1070
1071
  overflow-y: visible;
1071
1072
  }
1072
- `];Me([l.property({type:Array})],ie.prototype,"tags",2);Me([l.property({type:Array})],ie.prototype,"selected",2);Me([l.property()],ie.prototype,"filterKey",2);Me([l.query(".tag-search")],ie.prototype,"_searchInput",2);Me([l.state()],ie.prototype,"_search",2);ie=Me([l.customElement("ap-filter-tags")],ie);var ti=Object.defineProperty,si=Object.getOwnPropertyDescriptor,qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?si(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ti(e,s,a),a};let me=class extends o.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=mt}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:s,operator:y.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:[],operator:y.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
1073
+ `];Re([c.property({type:Array})],le.prototype,"tags",2);Re([c.property({type:Array})],le.prototype,"selected",2);Re([c.property()],le.prototype,"filterKey",2);Re([c.query(".tag-search")],le.prototype,"_searchInput",2);Re([c.state()],le.prototype,"_search",2);le=Re([c.customElement("ap-filter-tags")],le);var oa=Object.defineProperty,na=Object.getOwnPropertyDescriptor,Qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?na(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&oa(e,s,a),a};let ye=class extends o.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=$t}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.LABELS,values:s,operator:w.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.LABELS,values:e,operator:w.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.LABELS,values:[],operator:w.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
1073
1074
  <div
1074
1075
  class="label-item ${s?"disabled":""}"
1075
- title=${s?`You can select up to ${mt} labels`:o.nothing}
1076
+ title=${s?`You can select up to ${$t} labels`:o.nothing}
1076
1077
  @click=${()=>!s&&this._toggle(t.sid)}
1077
1078
  >
1078
1079
  <ap-checkbox ?checked=${e}></ap-checkbox>
@@ -1139,11 +1140,11 @@
1139
1140
  ${this._atLimit?o.html`
1140
1141
  <div class="info-alert">
1141
1142
  <ap-icon name="info" .size=${14}></ap-icon>
1142
- <span>You can select up to ${mt} labels.</span>
1143
+ <span>You can select up to ${$t} labels.</span>
1143
1144
  </div>
1144
1145
  `:o.nothing}
1145
1146
  </div>
1146
- `}};me.styles=[te,o.css`
1147
+ `}};ye.styles=[oe,o.css`
1147
1148
  .label-item {
1148
1149
  display: flex;
1149
1150
  align-items: center;
@@ -1192,9 +1193,9 @@
1192
1193
  flex-shrink: 0;
1193
1194
  line-height: 0;
1194
1195
  }
1195
- `];qe([l.property({type:Array})],me.prototype,"labels",2);qe([l.property({type:Array})],me.prototype,"selected",2);qe([l.query(".search-input")],me.prototype,"_searchInput",2);qe([l.state()],me.prototype,"_search",2);me=qe([l.customElement("ap-filter-labels")],me);var ai=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,Oe=(t,e,s,i)=>{for(var a=i>1?void 0:i?ii(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ai(e,s,a),a};const kt=3,Et=/^#[0-9A-Fa-f]{6}$/;function ri(t){const e=t.trim().split(/\s+/);return e.length<1||!Et.test(e[0])?null:{hex:e[0],tolerance:e[1]||Ze,coverage:e[3]||Qe}}let re=class extends o.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const i=ri(s);i&&e.push(i)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==Ze||s.coverage!==Qe)),this._initialized=!0)}}_selectColor(t){if(!Et.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=kt||(this._colors=[...this._colors,{hex:t,tolerance:Ze,coverage:Qe}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let i=e.target.value.trim();if(i.startsWith("#")||(i="#"+i),!Et.test(i)||this._colors.some((n,c)=>c!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const r=[...this._colors];r[t]={...r[t],hex:i},this._colors=r,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,i=parseInt(s,10);if(!isNaN(i)&&i>=1&&i<=100){const a=[...this._colors];a[t]={...a[t],coverage:String(i)},this._colors=a,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:Ze,i=this._advanced?e.coverage:Qe;return`${e.hex} ${s} ${s} ${i}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=kt;return o.html`
1196
+ `];Qe([c.property({type:Array})],ye.prototype,"labels",2);Qe([c.property({type:Array})],ye.prototype,"selected",2);Qe([c.query(".search-input")],ye.prototype,"_searchInput",2);Qe([c.state()],ye.prototype,"_search",2);ye=Qe([c.customElement("ap-filter-labels")],ye);var la=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,Ne=(t,e,s,i)=>{for(var a=i>1?void 0:i?ca(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&la(e,s,a),a};const Mt=3,Ot=/^#[0-9A-Fa-f]{6}$/;function da(t){const e=t.trim().split(/\s+/);return e.length<1||!Ot.test(e[0])?null:{hex:e[0],tolerance:e[1]||rt,coverage:e[3]||at}}let ce=class extends o.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const i=da(s);i&&e.push(i)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==rt||s.coverage!==at)),this._initialized=!0)}}_selectColor(t){if(!Ot.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=Mt||(this._colors=[...this._colors,{hex:t,tolerance:rt,coverage:at}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let i=e.target.value.trim();if(i.startsWith("#")||(i="#"+i),!Ot.test(i)||this._colors.some((n,l)=>l!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const r=[...this._colors];r[t]={...r[t],hex:i},this._colors=r,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,i=parseInt(s,10);if(!isNaN(i)&&i>=1&&i<=100){const a=[...this._colors];a[t]={...a[t],coverage:String(i)},this._colors=a,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:rt,i=this._advanced?e.coverage:at;return`${e.hex} ${s} ${s} ${i}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=Mt;return o.html`
1196
1197
  <div class="palette">
1197
- ${ea.map(s=>{const i=t.has(s),a=e&&!i;return o.html`
1198
+ ${oi.map(s=>{const i=t.has(s),a=e&&!i;return o.html`
1198
1199
  <button
1199
1200
  class="swatch ${i?"selected":""} ${a?"disabled":""}"
1200
1201
  style="background:${s};${s==="#ffffff"?" border: 1px solid #e4e4e7;":""}"
@@ -1223,7 +1224,7 @@
1223
1224
  <span class="adv-field-label">Difference</span>
1224
1225
  <ap-dropdown
1225
1226
  .value=${t.tolerance}
1226
- .options=${ta}
1227
+ .options=${ni}
1227
1228
  @ap-change=${s=>this._handleToleranceChange(e,s)}
1228
1229
  ></ap-dropdown>
1229
1230
  </div>
@@ -1259,7 +1260,7 @@
1259
1260
  <ap-icon name="close" .size=${14}></ap-icon>
1260
1261
  </button>
1261
1262
  </div>
1262
- `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<kt&&!this._showPalette;return o.html`
1263
+ `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<Mt&&!this._showPalette;return o.html`
1263
1264
  <div class="filter-content">
1264
1265
  <button
1265
1266
  class="clear-btn"
@@ -1304,7 +1305,7 @@
1304
1305
  <span>Requires image processing to be enabled.</span>
1305
1306
  </div>
1306
1307
  </div>
1307
- `}};re.styles=[J,te,o.css`
1308
+ `}};ce.styles=[W,oe,o.css`
1308
1309
  /* ── Palette ── */
1309
1310
  .palette {
1310
1311
  display: grid;
@@ -1541,7 +1542,7 @@
1541
1542
  .add-color-btn:hover {
1542
1543
  opacity: 0.8;
1543
1544
  }
1544
- `];Oe([l.property({type:Array})],re.prototype,"values",2);Oe([l.state()],re.prototype,"_colors",2);Oe([l.state()],re.prototype,"_advanced",2);Oe([l.state()],re.prototype,"_showPalette",2);Oe([l.state()],re.prototype,"_initialized",2);re=Oe([l.customElement("ap-filter-color")],re);var oi=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?ni(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&oi(e,s,a),a};const li={KB:1/1e3,MB:1,GB:1e3},ci=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let Q=class extends o.LitElement{constructor(){super(...arguments),this.min=0,this.max=0,this._minVal="",this._maxVal="",this._unit="MB",this._initialized=!1}willUpdate(t){!this._initialized&&(t.has("min")||t.has("max"))&&(this._initialized=!0,this.min>0&&(this._minVal=String(this.min)),this.max>0&&(this._maxVal=String(this.max)))}get _hasFilter(){return this._minVal!==""||this._maxVal!==""}_clearAll(){this._minVal="",this._maxVal="",this._emitChange()}_setUnit(t){this._unit=t.detail.value,this._emitChange()}_emitChange(){const t=li[this._unit],e=this._minVal!==""?parseFloat((parseFloat(this._minVal)*t).toFixed(2)).toString():null,s=this._maxVal!==""?parseFloat((parseFloat(this._maxVal)*t).toFixed(2)).toString():null;let i;if(e!==null&&s!==null)i=`${e}..${s}`;else if(e!==null)i=`${e}..`;else if(s!==null)i=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[],operator:y.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[i],operator:y.RANGE},bubbles:!0,composed:!0}))}_onMinInput(t){this._minVal=t.target.value,this._emitChange()}_onMaxInput(t){this._maxVal=t.target.value,this._emitChange()}render(){return o.html`
1545
+ `];Ne([c.property({type:Array})],ce.prototype,"values",2);Ne([c.state()],ce.prototype,"_colors",2);Ne([c.state()],ce.prototype,"_advanced",2);Ne([c.state()],ce.prototype,"_showPalette",2);Ne([c.state()],ce.prototype,"_initialized",2);ce=Ne([c.customElement("ap-filter-color")],ce);var pa=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,Se=(t,e,s,i)=>{for(var a=i>1?void 0:i?ha(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&pa(e,s,a),a};const ua={KB:1/1e3,MB:1,GB:1e3},ga=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let se=class extends o.LitElement{constructor(){super(...arguments),this.min=0,this.max=0,this._minVal="",this._maxVal="",this._unit="MB",this._initialized=!1}willUpdate(t){!this._initialized&&(t.has("min")||t.has("max"))&&(this._initialized=!0,this.min>0&&(this._minVal=String(this.min)),this.max>0&&(this._maxVal=String(this.max)))}get _hasFilter(){return this._minVal!==""||this._maxVal!==""}_clearAll(){this._minVal="",this._maxVal="",this._emitChange()}_setUnit(t){this._unit=t.detail.value,this._emitChange()}_emitChange(){const t=ua[this._unit],e=this._minVal!==""?parseFloat((parseFloat(this._minVal)*t).toFixed(2)).toString():null,s=this._maxVal!==""?parseFloat((parseFloat(this._maxVal)*t).toFixed(2)).toString():null;let i;if(e!==null&&s!==null)i=`${e}..${s}`;else if(e!==null)i=`${e}..`;else if(s!==null)i=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.SIZE,values:[],operator:w.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.SIZE,values:[i],operator:w.RANGE},bubbles:!0,composed:!0}))}_onMinInput(t){this._minVal=t.target.value,this._emitChange()}_onMaxInput(t){this._maxVal=t.target.value,this._emitChange()}render(){return o.html`
1545
1546
  <div class="filter-content">
1546
1547
  <span class="section-label">Size</span>
1547
1548
  <button
@@ -1578,14 +1579,14 @@
1578
1579
  <div>
1579
1580
  <span class="input-label">Unit</span>
1580
1581
  <ap-dropdown
1581
- .options=${ci}
1582
+ .options=${ga}
1582
1583
  .value=${this._unit}
1583
1584
  @ap-change=${this._setUnit}
1584
1585
  ></ap-dropdown>
1585
1586
  </div>
1586
1587
  </div>
1587
1588
  </div>
1588
- `}};Q.styles=[te,o.css`
1589
+ `}};se.styles=[oe,o.css`
1589
1590
  /* Hide number input spinners */
1590
1591
  .filter-input[type='number']::-webkit-inner-spin-button,
1591
1592
  .filter-input[type='number']::-webkit-outer-spin-button {
@@ -1604,19 +1605,19 @@
1604
1605
  display: block;
1605
1606
  width: 100%;
1606
1607
  }
1607
- `];ye([l.property({type:Number})],Q.prototype,"min",2);ye([l.property({type:Number})],Q.prototype,"max",2);ye([l.state()],Q.prototype,"_minVal",2);ye([l.state()],Q.prototype,"_maxVal",2);ye([l.state()],Q.prototype,"_unit",2);ye([l.state()],Q.prototype,"_initialized",2);Q=ye([l.customElement("ap-filter-size")],Q);var di=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,ht=(t,e,s,i)=>{for(var a=i>1?void 0:i?pi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&di(e,s,a),a};const hi=o.svg`
1608
+ `];Se([c.property({type:Number})],se.prototype,"min",2);Se([c.property({type:Number})],se.prototype,"max",2);Se([c.state()],se.prototype,"_minVal",2);Se([c.state()],se.prototype,"_maxVal",2);Se([c.state()],se.prototype,"_unit",2);Se([c.state()],se.prototype,"_initialized",2);se=Se([c.customElement("ap-filter-size")],se);var fa=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,vt=(t,e,s,i)=>{for(var a=i>1?void 0:i?ma(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fa(e,s,a),a};const va=o.svg`
1608
1609
  <svg width="20" height="20" viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1609
1610
  <path d="M2.66666 1.9987C2.29847 1.9987 1.99999 2.29717 1.99999 2.66536L1.99999 13.332C1.99999 13.7002 2.29847 13.9987 2.66666 13.9987L9.33332 13.9987C9.70151 13.9987 9.99999 13.7002 9.99999 13.332L9.99999 2.66536C9.99999 2.29717 9.70151 1.9987 9.33332 1.9987L2.66666 1.9987ZM9.33332 0.665364C10.4379 0.665364 11.3333 1.56079 11.3333 2.66536L11.3333 13.332C11.3333 14.4366 10.4379 15.332 9.33332 15.332L2.66666 15.332C1.56209 15.332 0.666656 14.4366 0.666656 13.332L0.666656 2.66536C0.666656 1.56079 1.56209 0.665364 2.66666 0.665364L9.33332 0.665364Z" fill="#9747FF"/>
1610
1611
  <path d="M5.33332 4.65885C5.33332 4.29066 5.6318 3.99219 5.99999 3.99219C6.36818 3.99219 6.66666 4.29066 6.66666 4.65885L6.66666 4.66536C6.66666 5.03355 6.36818 5.33203 5.99999 5.33203C5.6318 5.33203 5.33332 5.03355 5.33332 4.66536L5.33332 4.65885Z" fill="#9747FF"/>
1611
1612
  <path d="M5.33332 11.3255C5.33332 10.9573 5.6318 10.6589 5.99999 10.6589C6.36818 10.6589 6.66666 10.9573 6.66666 11.3255L6.66666 11.332C6.66666 11.7002 6.36818 11.9987 5.99999 11.9987C5.6318 11.9987 5.33332 11.7002 5.33332 11.332L5.33332 11.3255Z" fill="#9747FF"/>
1612
1613
  </svg>
1613
- `,ui=o.svg`
1614
+ `,ba=o.svg`
1614
1615
  <svg width="20" height="20" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
1615
1616
  <path d="M14 2.66797C14 2.29978 13.7015 2.0013 13.3333 2.0013H2.66666C2.29847 2.0013 1.99999 2.29978 1.99999 2.66797V9.33463C1.99999 9.70282 2.29847 10.0013 2.66666 10.0013H13.3333C13.7015 10.0013 14 9.70282 14 9.33463V2.66797ZM15.3333 9.33463C15.3333 10.4392 14.4379 11.3346 13.3333 11.3346H2.66666C1.56209 11.3346 0.666656 10.4392 0.666656 9.33463V2.66797C0.666656 1.5634 1.56209 0.667969 2.66666 0.667969H13.3333C14.4379 0.667969 15.3333 1.5634 15.3333 2.66797V9.33463Z" fill="#65A30D"/>
1616
1617
  <path d="M11.3398 5.33464C11.708 5.33464 12.0065 5.63311 12.0065 6.0013C12.0065 6.36949 11.708 6.66797 11.3398 6.66797H11.3333C10.9651 6.66797 10.6667 6.36949 10.6667 6.0013C10.6667 5.63311 10.9651 5.33464 11.3333 5.33464H11.3398Z" fill="#65A30D"/>
1617
1618
  <path d="M4.67317 5.33464C5.04136 5.33464 5.33983 5.63311 5.33983 6.0013C5.33983 6.36949 5.04136 6.66797 4.67317 6.66797H4.66666C4.29847 6.66797 3.99999 6.36949 3.99999 6.0013C3.99999 5.63311 4.29847 5.33464 4.66666 5.33464H4.67317Z" fill="#65A30D"/>
1618
1619
  </svg>
1619
- `,gi=o.svg`
1620
+ `,_a=o.svg`
1620
1621
  <svg width="20" height="20" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1621
1622
  <path d="M12.3333 2.33203C12.3333 1.96384 12.0349 1.66536 11.6667 1.66536H2.33334C1.96515 1.66536 1.66668 1.96384 1.66668 2.33203V11.6654C1.66668 12.0336 1.96515 12.332 2.33334 12.332H11.6667C12.0349 12.332 12.3333 12.0336 12.3333 11.6654V2.33203ZM13.6667 11.6654C13.6667 12.7699 12.7712 13.6654 11.6667 13.6654H2.33334C1.22877 13.6654 0.333344 12.7699 0.333344 11.6654V2.33203C0.333344 1.22746 1.22877 0.332031 2.33334 0.332031H11.6667C12.7712 0.332031 13.6667 1.22746 13.6667 2.33203V11.6654Z" fill="#6366F1"/>
1622
1623
  <path d="M9.67319 3.66536C10.0414 3.66536 10.3399 3.96384 10.3399 4.33203C10.3399 4.70022 10.0414 4.9987 9.67319 4.9987H9.66668C9.29849 4.9987 9.00001 4.70022 9.00001 4.33203C9.00001 3.96384 9.29849 3.66536 9.66668 3.66536H9.67319Z" fill="#6366F1"/>
@@ -1624,13 +1625,13 @@
1624
1625
  <path d="M4.33985 8.9987C4.70804 8.9987 5.00652 9.29718 5.00652 9.66537C5.00652 10.0336 4.70804 10.332 4.33985 10.332H4.33334C3.96515 10.332 3.66668 10.0336 3.66668 9.66537C3.66668 9.29718 3.96515 8.9987 4.33334 8.9987H4.33985Z" fill="#6366F1"/>
1625
1626
  <path d="M9.67319 8.9987C10.0414 8.9987 10.3399 9.29718 10.3399 9.66537C10.3399 10.0336 10.0414 10.332 9.67319 10.332H9.66668C9.29849 10.332 9.00001 10.0336 9.00001 9.66537C9.00001 9.29718 9.29849 8.9987 9.66668 8.9987H9.67319Z" fill="#6366F1"/>
1626
1627
  </svg>
1627
- `,fi=o.svg`
1628
+ `,ya=o.svg`
1628
1629
  <svg width="20" height="20" viewBox="0 0 16 8" fill="none" xmlns="http://www.w3.org/2000/svg">
1629
1630
  <path d="M14 2.33203C14 1.96384 13.7015 1.66536 13.3333 1.66536H2.66666C2.29847 1.66536 1.99999 1.96384 1.99999 2.33203V5.66536C1.99999 6.03355 2.29847 6.33203 2.66666 6.33203H13.3333C13.7015 6.33203 14 6.03355 14 5.66536V2.33203ZM15.3333 5.66536C15.3333 6.76993 14.4379 7.66536 13.3333 7.66536H2.66666C1.56209 7.66536 0.666656 6.76993 0.666656 5.66536V2.33203C0.666656 1.22746 1.56209 0.332031 2.66666 0.332031H13.3333C14.4379 0.332031 15.3333 1.22746 15.3333 2.33203V5.66536Z" fill="#4BA3AD"/>
1630
1631
  <path d="M11.3398 3.33203C11.708 3.33203 12.0065 3.63051 12.0065 3.9987C12.0065 4.36689 11.708 4.66536 11.3398 4.66536H11.3333C10.9651 4.66536 10.6667 4.36689 10.6667 3.9987C10.6667 3.63051 10.9651 3.33203 11.3333 3.33203H11.3398Z" fill="#4BA3AD"/>
1631
1632
  <path d="M4.67317 3.33203C5.04136 3.33203 5.33983 3.63051 5.33983 3.9987C5.33983 4.36689 5.04136 4.66536 4.67317 4.66536H4.66666C4.29847 4.66536 3.99999 4.36689 3.99999 3.9987C3.99999 3.63051 4.29847 3.33203 4.66666 3.33203H4.67317Z" fill="#4BA3AD"/>
1632
1633
  </svg>
1633
- `,mi={portrait:hi,landscape:ui,square:gi,panorama:fi};let Ee=class extends o.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return o.html`
1634
+ `,xa={portrait:va,landscape:ba,square:_a,panorama:ya};let Oe=class extends o.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return o.html`
1634
1635
  <div class="filter-content">
1635
1636
  <button
1636
1637
  class="clear-btn"
@@ -1641,7 +1642,7 @@
1641
1642
  <div class="filter-section">
1642
1643
  <span class="section-label">Resolution</span>
1643
1644
  <div class="options-horizontal">
1644
- ${Ws.map(t=>o.html`
1645
+ ${si.map(t=>o.html`
1645
1646
  <ap-checkbox
1646
1647
  ?checked=${this.selectedResolution.includes(t.value)}
1647
1648
  @ap-toggle=${()=>{this._toggleResolution(t.value)}}
@@ -1653,11 +1654,11 @@
1653
1654
  <div class="filter-section">
1654
1655
  <span class="section-label">Orientation</span>
1655
1656
  <div class="options-vertical">
1656
- ${Qs.map(t=>o.html`
1657
+ ${ii.map(t=>o.html`
1657
1658
  <ap-checkbox
1658
1659
  ?checked=${this.selectedOrientation.includes(t.value)}
1659
1660
  @ap-toggle=${()=>{this._toggleOrientation(t.value)}}
1660
- ><span class="orientation-label">${mi[t.value]}${t.label}</span></ap-checkbox>
1661
+ ><span class="orientation-label">${xa[t.value]}${t.label}</span></ap-checkbox>
1661
1662
  `)}
1662
1663
  </div>
1663
1664
  </div>
@@ -1665,7 +1666,7 @@
1665
1666
  <div class="filter-section">
1666
1667
  <span class="section-label">Faces</span>
1667
1668
  <div class="options-horizontal">
1668
- ${Zs.map(t=>o.html`
1669
+ ${ai.map(t=>o.html`
1669
1670
  <ap-checkbox
1670
1671
  ?checked=${this.selectedFaces.includes(t.value)}
1671
1672
  @ap-toggle=${()=>{this._toggleFaces(t.value)}}
@@ -1679,7 +1680,7 @@
1679
1680
  <span>Some images might not have been processed, so they won't be displayed.</span>
1680
1681
  </div>
1681
1682
  </div>
1682
- `}};Ee.styles=[te,o.css`
1683
+ `}};Oe.styles=[oe,o.css`
1683
1684
  .options-horizontal {
1684
1685
  display: flex;
1685
1686
  gap: 28px;
@@ -1700,14 +1701,14 @@
1700
1701
  .orientation-label svg {
1701
1702
  flex-shrink: 0;
1702
1703
  }
1703
- `];ht([l.property({type:Array})],Ee.prototype,"selectedResolution",2);ht([l.property({type:Array})],Ee.prototype,"selectedOrientation",2);ht([l.property({type:Array})],Ee.prototype,"selectedFaces",2);Ee=ht([l.customElement("ap-filter-image")],Ee);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,T=(t,e,s,i)=>{for(var a=i>1?void 0:i?bi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vi(e,s,a),a};function w(t){return`${dt[t.type]||""}${t.key}`}let A=class extends o.LitElement{constructor(){super(...arguments),this.fields=[],this.appliedFilters={},this.visibleFields=[],this.mode="full",this.activeFieldKey="",this.pinnedFields=[],this.appliedMetadata={},this._showFieldSelection=!1,this._fieldSearch="",this._collapsedFields=new Set,this._tagInputs={},this._tagSuggestions={},this._tagLoading={},this._datePresets={},this._dateFroms={},this._dateTos={},this._specificModeFields=new Set,this._selectSearches={},this._tagDebounceTimers={}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this._focusSearch())}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this._tagDebounceTimers))clearTimeout(t)}_focusSearch(){const t=this.renderRoot.querySelector(".field-search, .search-input");t==null||t.focus()}get _atFieldLimit(){return this.visibleFields.length>=Xe}_getField(t){return this.fields.find(e=>w(e)===t)}_getUIType(t){return ra[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===U||t[0]===B}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===U?U:((i=e.values)==null?void 0:i[0])===B?B:this._specificModeFields.has(t)||e.values&&e.values.length>0?he:""}_emitFilterChange(t,e,s){const i=w(t);this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:{fieldKey:i,operator:e,values:s,metadataType:t.type},bubbles:!0,composed:!0}))}_emitFieldToggle(t,e){const s=w(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=w(t);!this.visibleFields.includes(e)&&this._atFieldLimit||(this.visibleFields.includes(e)||this._emitFieldToggle(t,!0),this.dispatchEvent(new CustomEvent("metadata-field-select",{detail:{fieldKey:e},bubbles:!0,composed:!0})))}_emitPin(t,e){this.dispatchEvent(new CustomEvent("metadata-pin",{detail:{fieldKey:t,pinned:e},bubbles:!0,composed:!0}))}_openFieldSelection(){this._showFieldSelection=!0,this._fieldSearch=""}_closeFieldSelection(){this._showFieldSelection=!1,this._fieldSearch=""}_addField(t){if(this._atFieldLimit)return;const e=w(t);this.visibleFields.includes(e)||this._emitFieldToggle(t,!0)}_removeField(t){this._emitFieldToggle(t,!1),this._emitFilterChange(t,void 0,[])}_toggleCollapse(t){const e=new Set(this._collapsedFields);e.has(t)?e.delete(t):e.add(t),this._collapsedFields=e}_onOperatorChange(t,e){const i=this._getApplied(w(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=w(t);if(e===he){const i=new Set(this._specificModeFields);i.add(s),this._specificModeFields=i;const a=this._getApplied(s);this._isSpecialValue(a.values)&&this._emitFilterChange(t,a.operator,[])}else{if(this._specificModeFields.has(s)){const i=new Set(this._specificModeFields);i.delete(s),this._specificModeFields=i}this._onEmptyOption(t,e)}}_clearFieldFilter(t){const e=w(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...i}=this._datePresets;this._datePresets=i;const{[e]:a,...r}=this._dateFroms;this._dateFroms=r;const{[e]:n,...c}=this._dateTos;this._dateTos=c;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...f}=this._tagInputs;this._tagInputs=f,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(w(t)).operator||bt[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=w(t),r=this._getApplied(a),n=r.operator||yt[0].value,c=[...r.values||[]];s===0?c[0]=i:c[1]=i;const d=c.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===_.DECIMAL2;if(!d.every(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var a;const s=this._getApplied(w(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];r.length===1&&r[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||_t[0].value,r=i.values||[],n=r.includes(e)?r.filter(c=>c!==e):[...r,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=w(t);(e.key==="Enter"||e.key===",")&&(e.preventDefault(),this._commitTagInput(t,s))}_onTagInput(t,e,s){const i=s.target.value;if(i.includes(",")){const a=i.replace(/,/g,"").trim();a&&(this._tagInputs={...this._tagInputs,[e]:a},this._commitTagInput(t,e));return}this._tagInputs={...this._tagInputs,[e]:i},this._fetchTagSuggestions(t,e,i.trim())}_selectTagSuggestion(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];r.includes(e)||this._emitFilterChange(t,a,[...r,e]),this._tagInputs={...this._tagInputs,[s]:""},this._tagSuggestions={...this._tagSuggestions,[s]:[]}}_fetchTagSuggestions(t,e,s){if(this._tagDebounceTimers[e]&&clearTimeout(this._tagDebounceTimers[e]),!s||!this.apiClient){this._tagSuggestions={...this._tagSuggestions,[e]:[]},this._tagLoading={...this._tagLoading,[e]:!1};return}this._tagDebounceTimers[e]=setTimeout(async()=>{this._tagLoading={...this._tagLoading,[e]:!0};try{const i=`_${t.ckey||t.key}`,a=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:i});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(a.tags||[]).map(r=>r.tag)})}catch{this._tagSuggestions={...this._tagSuggestions,[e]:[]}}finally{this._tagLoading={...this._tagLoading,[e]:!1}}},300)}_commitTagInput(t,e){const s=(this._tagInputs[e]||"").trim();if(!s)return;const i=this._getApplied(e),a=i.operator||X[0].value,r=i.values||[];r.includes(s)||this._emitFilterChange(t,a,[...r,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];this._emitFilterChange(t,a,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=w(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=w(t);if(this._datePresets={...this._datePresets,[s]:e},["before","after","between"].includes(e)){this._dateFroms={...this._dateFroms,[s]:""},this._dateTos={...this._dateTos,[s]:""};return}if(e==="empty"||e==="non-empty"){this._emitFilterChange(t,void 0,[e]);return}const i=new Date;let a="",r="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),r=i.toISOString();break}case"last_week":{const n=new Date(i),c=n.getDay();n.setDate(n.getDate()-(c===0?6:c-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),a=d.toISOString(),r=n.toISOString();break}case"last_month":{const n=new Date(i.getFullYear(),i.getMonth(),1),c=new Date(n);c.setMonth(c.getMonth()-1),a=c.toISOString(),r=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),c=new Date(n);c.setFullYear(c.getFullYear()-1),a=c.toISOString(),r=n.toISOString();break}}a&&r&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:r},this._emitFilterChange(t,"..",[a,r]))}_onDateInput(t,e,s){const i=s.target.value,a=w(t),r=this._datePresets[a]||"",n=i?new Date(i+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[a]:n}:this._dateTos={...this._dateTos,[a]:n};let c=this._dateFroms[a]||"",d=this._dateTos[a]||"";r==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),r==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),i=w(t),a=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${i}"]`),r=(a==null?void 0:a.value)||"";if(!s){this._emitFilterChange(t,void 0,[]);return}const n=s.split(",").map(p=>p.trim());if(n.length!==2||n.some(p=>isNaN(Number(p))||p===""))return;const[c,d]=n;let u=`${c},${d}..${r||"0"}`;this._emitFilterChange(t,y.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=w(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const r=a.values[0],[n]=r.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,y.IS,[c])}_onEmptyOption(t,e){var a;const s=this._getApplied(w(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_getGroupedFields(t){const e=new Map;for(const s of t){const i=s.group||"Root fields";e.has(i)||e.set(i,[]),e.get(i).push(s)}return e}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,r)=>r.length===0?o.nothing:o.html`
1704
+ `];vt([c.property({type:Array})],Oe.prototype,"selectedResolution",2);vt([c.property({type:Array})],Oe.prototype,"selectedOrientation",2);vt([c.property({type:Array})],Oe.prototype,"selectedFaces",2);Oe=vt([c.customElement("ap-filter-image")],Oe);var wa=Object.defineProperty,$a=Object.getOwnPropertyDescriptor,M=(t,e,s,i)=>{for(var a=i>1?void 0:i?$a(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&wa(e,s,a),a};function k(t){return`${ft[t.type]||""}${t.key}`}let A=class extends o.LitElement{constructor(){super(...arguments),this.fields=[],this.appliedFilters={},this.visibleFields=[],this.mode="full",this.activeFieldKey="",this.pinnedFields=[],this.appliedMetadata={},this._showFieldSelection=!1,this._fieldSearch="",this._collapsedFields=new Set,this._tagInputs={},this._tagSuggestions={},this._tagLoading={},this._datePresets={},this._dateFroms={},this._dateTos={},this._specificModeFields=new Set,this._selectSearches={},this._tagDebounceTimers={}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this._focusSearch())}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this._tagDebounceTimers))clearTimeout(t)}_focusSearch(){const t=this.renderRoot.querySelector(".field-search, .search-input");t==null||t.focus()}get _atFieldLimit(){return this.visibleFields.length>=st}_getField(t){return this.fields.find(e=>k(e)===t)}_getUIType(t){return pi[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===U||t[0]===V}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===U?U:((i=e.values)==null?void 0:i[0])===V?V:this._specificModeFields.has(t)||e.values&&e.values.length>0?me:""}_emitFilterChange(t,e,s){const i=k(t);this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:{fieldKey:i,operator:e,values:s,metadataType:t.type},bubbles:!0,composed:!0}))}_emitFieldToggle(t,e){const s=k(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=k(t);!this.visibleFields.includes(e)&&this._atFieldLimit||(this.visibleFields.includes(e)||this._emitFieldToggle(t,!0),this.dispatchEvent(new CustomEvent("metadata-field-select",{detail:{fieldKey:e},bubbles:!0,composed:!0})))}_emitPin(t,e){this.dispatchEvent(new CustomEvent("metadata-pin",{detail:{fieldKey:t,pinned:e},bubbles:!0,composed:!0}))}_openFieldSelection(){this._showFieldSelection=!0,this._fieldSearch=""}_closeFieldSelection(){this._showFieldSelection=!1,this._fieldSearch=""}_addField(t){if(this._atFieldLimit)return;const e=k(t);this.visibleFields.includes(e)||this._emitFieldToggle(t,!0)}_removeField(t){this._emitFieldToggle(t,!1),this._emitFilterChange(t,void 0,[])}_toggleCollapse(t){const e=new Set(this._collapsedFields);e.has(t)?e.delete(t):e.add(t),this._collapsedFields=e}_onOperatorChange(t,e){const i=this._getApplied(k(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=k(t);if(e===me){const i=new Set(this._specificModeFields);i.add(s),this._specificModeFields=i;const a=this._getApplied(s);this._isSpecialValue(a.values)&&this._emitFilterChange(t,a.operator,[])}else{if(this._specificModeFields.has(s)){const i=new Set(this._specificModeFields);i.delete(s),this._specificModeFields=i}this._onEmptyOption(t,e)}}_clearFieldFilter(t){const e=k(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...i}=this._datePresets;this._datePresets=i;const{[e]:a,...r}=this._dateFroms;this._dateFroms=r;const{[e]:n,...l}=this._dateTos;this._dateTos=l;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...f}=this._tagInputs;this._tagInputs=f,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(k(t)).operator||St[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=k(t),r=this._getApplied(a),n=r.operator||Et[0].value,l=[...r.values||[]];s===0?l[0]=i:l[1]=i;const d=l.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===_.DECIMAL2;if(!d.every(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,l)}_onBooleanSelect(t,e){var a;const s=this._getApplied(k(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=k(t),i=this._getApplied(s),a=i.operator||ee[0].value,r=i.values||[];r.length===1&&r[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=k(t),i=this._getApplied(s),a=i.operator||Ct[0].value,r=i.values||[],n=r.includes(e)?r.filter(l=>l!==e):[...r,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=k(t);(e.key==="Enter"||e.key===",")&&(e.preventDefault(),this._commitTagInput(t,s))}_onTagInput(t,e,s){const i=s.target.value;if(i.includes(",")){const a=i.replace(/,/g,"").trim();a&&(this._tagInputs={...this._tagInputs,[e]:a},this._commitTagInput(t,e));return}this._tagInputs={...this._tagInputs,[e]:i},this._fetchTagSuggestions(t,e,i.trim())}_selectTagSuggestion(t,e){const s=k(t),i=this._getApplied(s),a=i.operator||ee[0].value,r=i.values||[];r.includes(e)||this._emitFilterChange(t,a,[...r,e]),this._tagInputs={...this._tagInputs,[s]:""},this._tagSuggestions={...this._tagSuggestions,[s]:[]}}_fetchTagSuggestions(t,e,s){if(this._tagDebounceTimers[e]&&clearTimeout(this._tagDebounceTimers[e]),!s||!this.apiClient){this._tagSuggestions={...this._tagSuggestions,[e]:[]},this._tagLoading={...this._tagLoading,[e]:!1};return}this._tagDebounceTimers[e]=setTimeout(async()=>{this._tagLoading={...this._tagLoading,[e]:!0};try{const i=`_${t.ckey||t.key}`,a=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:i});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(a.tags||[]).map(r=>r.tag)})}catch{this._tagSuggestions={...this._tagSuggestions,[e]:[]}}finally{this._tagLoading={...this._tagLoading,[e]:!1}}},300)}_commitTagInput(t,e){const s=(this._tagInputs[e]||"").trim();if(!s)return;const i=this._getApplied(e),a=i.operator||ee[0].value,r=i.values||[];r.includes(s)||this._emitFilterChange(t,a,[...r,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=k(t),i=this._getApplied(s),a=i.operator||ee[0].value,r=i.values||[];this._emitFilterChange(t,a,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=k(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=k(t);if(this._datePresets={...this._datePresets,[s]:e},["before","after","between"].includes(e)){this._dateFroms={...this._dateFroms,[s]:""},this._dateTos={...this._dateTos,[s]:""};return}if(e==="empty"||e==="non-empty"){this._emitFilterChange(t,void 0,[e]);return}const i=new Date;let a="",r="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),r=i.toISOString();break}case"last_week":{const n=new Date(i),l=n.getDay();n.setDate(n.getDate()-(l===0?6:l-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),a=d.toISOString(),r=n.toISOString();break}case"last_month":{const n=new Date(i.getFullYear(),i.getMonth(),1),l=new Date(n);l.setMonth(l.getMonth()-1),a=l.toISOString(),r=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),l=new Date(n);l.setFullYear(l.getFullYear()-1),a=l.toISOString(),r=n.toISOString();break}}a&&r&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:r},this._emitFilterChange(t,"..",[a,r]))}_onDateInput(t,e,s){const i=s.target.value,a=k(t),r=this._datePresets[a]||"",n=i?new Date(i+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[a]:n}:this._dateTos={...this._dateTos,[a]:n};let l=this._dateFroms[a]||"",d=this._dateTos[a]||"";r==="after"&&l&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),r==="before"&&d&&(l=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:l}),l&&d&&this._emitFilterChange(t,"..",[l,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),i=k(t),a=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${i}"]`),r=(a==null?void 0:a.value)||"";if(!s){this._emitFilterChange(t,void 0,[]);return}const n=s.split(",").map(p=>p.trim());if(n.length!==2||n.some(p=>isNaN(Number(p))||p===""))return;const[l,d]=n;let u=`${l},${d}..${r||"0"}`;this._emitFilterChange(t,w.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=k(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const r=a.values[0],[n]=r.split("..");let l=n;s&&(l+=`..${s}`),this._emitFilterChange(t,w.IS,[l])}_onEmptyOption(t,e){var a;const s=this._getApplied(k(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_getGroupedFields(t){const e=new Map;for(const s of t){const i=s.group||"Root fields";e.has(i)||e.set(i,[]),e.get(i).push(s)}return e}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,r)=>r.length===0?o.nothing:o.html`
1704
1705
  <div class="field-group-label">${a}</div>
1705
- ${r.map(n=>{const c=w(n),d=this.visibleFields.includes(c),h=!d&&this._atFieldLimit;return o.html`
1706
+ ${r.map(n=>{const l=k(n),d=this.visibleFields.includes(l),h=!d&&this._atFieldLimit;return o.html`
1706
1707
  <div
1707
1708
  class="field-item ${d?"selected":""} ${h?"disabled":""}"
1708
1709
  @click=${()=>!h&&!d&&this._addField(n)}
1709
1710
  >
1710
- ${d?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.html`<ap-icon name=${Je[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>`}
1711
+ ${d?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.html`<ap-icon name=${ot[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>`}
1711
1712
  <span>${n.label}</span>
1712
1713
  </div>
1713
1714
  `})}
@@ -1736,7 +1737,7 @@
1736
1737
  ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`${[...s.entries()].map(([a,r])=>i(a,r))}`}
1737
1738
  </div>
1738
1739
  </div>
1739
- `}_renderTextFilter(t){var h,u;const e=w(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===U||r===B,c=s.operator||bt[0].value,d=t.type===_.TEXT_AREA;return o.html`
1740
+ `}_renderTextFilter(t){var h,u;const e=k(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===U||r===V,l=s.operator||St[0].value,d=t.type===_.TEXT_AREA;return o.html`
1740
1741
  <div class="filter-content" style="position: relative;">
1741
1742
  <button
1742
1743
  class="clear-btn"
@@ -1748,8 +1749,8 @@
1748
1749
  <span class="section-label">Operator</span>
1749
1750
  <ap-radio-group
1750
1751
  direction="horizontal"
1751
- .options=${bt}
1752
- .value=${c}
1752
+ .options=${St}
1753
+ .value=${l}
1753
1754
  ?disabled=${n}
1754
1755
  @ap-change=${f=>this._onOperatorChange(t,f.detail.value)}
1755
1756
  ></ap-radio-group>
@@ -1758,13 +1759,13 @@
1758
1759
  <div class="filter-section">
1759
1760
  <span class="section-label">Content</span>
1760
1761
  <ap-radio-group
1761
- .options=${xt}
1762
+ .options=${Ft}
1762
1763
  .value=${r}
1763
1764
  @ap-change=${f=>this._onContentModeChange(t,f.detail.value)}
1764
1765
  ></ap-radio-group>
1765
1766
  </div>
1766
1767
 
1767
- ${r===he?o.html`
1768
+ ${r===me?o.html`
1768
1769
  <div class="filter-section">
1769
1770
  <span class="section-label">Value</span>
1770
1771
  ${d?o.html`
@@ -1787,11 +1788,11 @@
1787
1788
  </div>
1788
1789
  `:o.nothing}
1789
1790
  </div>
1790
- `}_renderNumberFilter(t){var $,F,j;const e=w(t),s=this._getApplied(e),i=s.operator||yt[0].value,a=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===U||r===B,c=i===y.RANGE,d=i===y.GREATER_THAN_OR_EQUAL,h=i===y.LESS_THAN_OR_EQUAL,u=t.type===_.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=a?"":(($=s.values)==null?void 0:$[0])||"",v=a?"":((F=s.values)==null?void 0:F[1])||"",x=c||d||h,b=c||d||h?"Min":"Value";return o.html`
1791
+ `}_renderNumberFilter(t){var b,C,T;const e=k(t),s=this._getApplied(e),i=s.operator||Et[0].value,a=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===U||r===V,l=i===w.RANGE,d=i===w.GREATER_THAN_OR_EQUAL,h=i===w.LESS_THAN_OR_EQUAL,u=t.type===_.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=a?"":((b=s.values)==null?void 0:b[0])||"",m=a?"":((C=s.values)==null?void 0:C[1])||"",y=l||d||h,x=l||d||h?"Min":"Value";return o.html`
1791
1792
  <div class="filter-content" style="position: relative;">
1792
1793
  <button
1793
1794
  class="clear-btn"
1794
- ?disabled=${!((j=s.values)!=null&&j.length)&&!s.operator}
1795
+ ?disabled=${!((T=s.values)!=null&&T.length)&&!s.operator}
1795
1796
  @click=${()=>this._clearFieldFilter(t)}
1796
1797
  >Clear all</button>
1797
1798
 
@@ -1799,27 +1800,27 @@
1799
1800
  <span class="section-label">Condition</span>
1800
1801
  <ap-radio-group
1801
1802
  columns="2"
1802
- .options=${yt}
1803
+ .options=${Et}
1803
1804
  .value=${i}
1804
1805
  ?disabled=${n}
1805
- @ap-change=${S=>this._onOperatorChange(t,S.detail.value)}
1806
+ @ap-change=${$=>this._onOperatorChange(t,$.detail.value)}
1806
1807
  ></ap-radio-group>
1807
1808
  </div>
1808
1809
 
1809
1810
  <div class="filter-section">
1810
1811
  <span class="section-label">Content</span>
1811
1812
  <ap-radio-group
1812
- .options=${xt}
1813
+ .options=${Ft}
1813
1814
  .value=${r}
1814
- @ap-change=${S=>this._onContentModeChange(t,S.detail.value)}
1815
+ @ap-change=${$=>this._onContentModeChange(t,$.detail.value)}
1815
1816
  ></ap-radio-group>
1816
1817
  </div>
1817
1818
 
1818
- ${r===he?o.html`
1819
+ ${r===me?o.html`
1819
1820
  <div class="filter-section">
1820
1821
  <div class="grid-2">
1821
1822
  <div>
1822
- <span class="input-label" aria-disabled=${h?"true":o.nothing}>${b}</span>
1823
+ <span class="input-label" aria-disabled=${h?"true":o.nothing}>${x}</span>
1823
1824
  <input
1824
1825
  class="filter-input"
1825
1826
  type="number"
@@ -1827,10 +1828,10 @@
1827
1828
  placeholder=${p}
1828
1829
  .value=${g}
1829
1830
  ?disabled=${h}
1830
- @change=${S=>this._onNumberInput(t,S,0)}
1831
+ @change=${$=>this._onNumberInput(t,$,0)}
1831
1832
  />
1832
1833
  </div>
1833
- ${x?o.html`
1834
+ ${y?o.html`
1834
1835
  <div>
1835
1836
  <span class="input-label" aria-disabled=${d?"true":o.nothing}>${"Max"}</span>
1836
1837
  <input
@@ -1838,9 +1839,9 @@
1838
1839
  type="number"
1839
1840
  step=${f}
1840
1841
  placeholder=${p}
1841
- .value=${v}
1842
+ .value=${m}
1842
1843
  ?disabled=${d}
1843
- @change=${S=>this._onNumberInput(t,S,1)}
1844
+ @change=${$=>this._onNumberInput(t,$,1)}
1844
1845
  />
1845
1846
  </div>
1846
1847
  `:o.nothing}
@@ -1848,7 +1849,7 @@
1848
1849
  </div>
1849
1850
  `:o.nothing}
1850
1851
  </div>
1851
- `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(w(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
1852
+ `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(k(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
1852
1853
  <div class="filter-content" style="position: relative;">
1853
1854
  <button
1854
1855
  class="clear-btn"
@@ -1859,13 +1860,13 @@
1859
1860
  <div class="filter-section">
1860
1861
  <span class="section-label">Value</span>
1861
1862
  <ap-radio-group
1862
- .options=${ia}
1863
+ .options=${di}
1863
1864
  .value=${s}
1864
1865
  @ap-change=${r=>this._onBooleanSelect(t,r.detail.value)}
1865
1866
  ></ap-radio-group>
1866
1867
  </div>
1867
1868
  </div>
1868
- `}_renderSelectOneFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||X[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=a.length>=Xe;return o.html`
1869
+ `}_renderSelectOneFilter(t){const e=k(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||ee[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=a.length>0||i,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=a.length>=st;return o.html`
1869
1870
  <div class="filter-content">
1870
1871
  <!-- Search input -->
1871
1872
  <div class="search-wrapper">
@@ -1906,7 +1907,7 @@
1906
1907
  </div>
1907
1908
  <ap-radio-group
1908
1909
  direction="horizontal"
1909
- .options=${X}
1910
+ .options=${ee}
1910
1911
  .value=${n}
1911
1912
  @ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
1912
1913
  ></ap-radio-group>
@@ -1916,7 +1917,7 @@
1916
1917
  ${a.length>0?o.html`
1917
1918
  <div class="filter-section">
1918
1919
  <div class="chips-wrap">
1919
- ${a.map(p=>{const g=r.find(v=>v.api_value===p);return o.html`
1920
+ ${a.map(p=>{const g=r.find(m=>m.api_value===p);return o.html`
1920
1921
  <div class="chip">
1921
1922
  <span class="chip-label">${(g==null?void 0:g.label)||p}</span>
1922
1923
  <button class="chip-remove" @click=${()=>this._onSelectOneToggle(t,p)}>
@@ -1935,7 +1936,7 @@
1935
1936
 
1936
1937
  <!-- Empty/Not empty checkboxes -->
1937
1938
  <div class="options-list short">
1938
- ${ge.map(p=>{var g;return o.html`
1939
+ ${be.map(p=>{var g;return o.html`
1939
1940
  <div
1940
1941
  class="option-item"
1941
1942
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -1950,10 +1951,10 @@
1950
1951
 
1951
1952
  <!-- Regular options -->
1952
1953
  <div class="options-list">
1953
- ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),v=!g&&f;return o.html`
1954
+ ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),m=!g&&f;return o.html`
1954
1955
  <div
1955
- class="option-item ${v?"disabled":""}"
1956
- @click=${()=>!v&&this._onSelectOneToggle(t,p.api_value)}
1956
+ class="option-item ${m?"disabled":""}"
1957
+ @click=${()=>!m&&this._onSelectOneToggle(t,p.api_value)}
1957
1958
  >
1958
1959
  <ap-checkbox ?checked=${g}></ap-checkbox>
1959
1960
  <span>${p.label}</span>
@@ -1962,7 +1963,7 @@
1962
1963
  </div>
1963
1964
  </div>
1964
1965
  </div>
1965
- `}_renderMultiSelectFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||_t[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=a.length>=Xe;return o.html`
1966
+ `}_renderMultiSelectFilter(t){const e=k(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||Ct[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=a.length>0||i,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=a.length>=st;return o.html`
1966
1967
  <div class="filter-content">
1967
1968
  <!-- Search input -->
1968
1969
  <div class="search-wrapper">
@@ -2003,7 +2004,7 @@
2003
2004
  </div>
2004
2005
  <ap-radio-group
2005
2006
  direction="horizontal"
2006
- .options=${_t}
2007
+ .options=${Ct}
2007
2008
  .value=${n}
2008
2009
  @ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
2009
2010
  ></ap-radio-group>
@@ -2013,7 +2014,7 @@
2013
2014
  ${a.length>0?o.html`
2014
2015
  <div class="filter-section">
2015
2016
  <div class="chips-wrap">
2016
- ${a.map(p=>{const g=r.find(v=>v.api_value===p);return o.html`
2017
+ ${a.map(p=>{const g=r.find(m=>m.api_value===p);return o.html`
2017
2018
  <div class="chip">
2018
2019
  <span class="chip-label">${(g==null?void 0:g.label)||p}</span>
2019
2020
  <button class="chip-remove" @click=${()=>this._onMultiSelectToggle(t,p)}>
@@ -2032,7 +2033,7 @@
2032
2033
 
2033
2034
  <!-- Empty/Not empty checkboxes -->
2034
2035
  <div class="options-list short">
2035
- ${ge.map(p=>{var g;return o.html`
2036
+ ${be.map(p=>{var g;return o.html`
2036
2037
  <div
2037
2038
  class="option-item"
2038
2039
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -2047,10 +2048,10 @@
2047
2048
 
2048
2049
  <!-- Regular options -->
2049
2050
  <div class="options-list">
2050
- ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),v=!g&&f;return o.html`
2051
+ ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),m=!g&&f;return o.html`
2051
2052
  <div
2052
- class="option-item ${v?"disabled":""}"
2053
- @click=${()=>!v&&this._onMultiSelectToggle(t,p.api_value)}
2053
+ class="option-item ${m?"disabled":""}"
2054
+ @click=${()=>!m&&this._onMultiSelectToggle(t,p.api_value)}
2054
2055
  >
2055
2056
  <ap-checkbox ?checked=${g}></ap-checkbox>
2056
2057
  <span>${p.label}</span>
@@ -2059,7 +2060,7 @@
2059
2060
  </div>
2060
2061
  </div>
2061
2062
  </div>
2062
- `}_renderTagsFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||X[0].value,c=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=a.length>=Xe;return o.html`
2063
+ `}_renderTagsFilter(t){const e=k(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||ee[0].value,l=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=a.length>=st;return o.html`
2063
2064
  <div class="filter-content">
2064
2065
  <!-- Search input -->
2065
2066
  <div class="search-wrapper">
@@ -2084,7 +2085,7 @@
2084
2085
  <span class="section-label"></span>
2085
2086
  <button
2086
2087
  class="clear-btn"
2087
- ?disabled=${!c&&!s.operator}
2088
+ ?disabled=${!l&&!s.operator}
2088
2089
  @click=${()=>this._clearFieldFilter(t)}
2089
2090
  >Clear all</button>
2090
2091
  </div>
@@ -2095,13 +2096,13 @@
2095
2096
  <span class="section-label">Condition</span>
2096
2097
  <button
2097
2098
  class="clear-btn"
2098
- ?disabled=${!c&&!s.operator}
2099
+ ?disabled=${!l&&!s.operator}
2099
2100
  @click=${()=>this._clearFieldFilter(t)}
2100
2101
  >Clear all</button>
2101
2102
  </div>
2102
2103
  <ap-radio-group
2103
2104
  direction="horizontal"
2104
- .options=${X}
2105
+ .options=${ee}
2105
2106
  .value=${n}
2106
2107
  ?disabled=${i}
2107
2108
  @ap-change=${p=>this._onTagOperatorChange(t,p.detail.value)}
@@ -2128,7 +2129,7 @@
2128
2129
  <div class="filter-section">
2129
2130
  <span class="section-label">All options</span>
2130
2131
  <div class="options-list short">
2131
- ${ge.map(p=>{var g;return o.html`
2132
+ ${be.map(p=>{var g;return o.html`
2132
2133
  <div
2133
2134
  class="option-item"
2134
2135
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -2145,10 +2146,10 @@
2145
2146
  ${u?o.html`
2146
2147
  <div class="filter-section">
2147
2148
  <div class="options-list">
2148
- ${h?o.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const g=a.includes(p),v=!g&&f;return o.html`
2149
+ ${h?o.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const g=a.includes(p),m=!g&&f;return o.html`
2149
2150
  <div
2150
- class="option-item ${v?"disabled":""}"
2151
- @click=${()=>!v&&(g?this._removeTag(t,p):this._selectTagSuggestion(t,p))}
2151
+ class="option-item ${m?"disabled":""}"
2152
+ @click=${()=>!m&&(g?this._removeTag(t,p):this._selectTagSuggestion(t,p))}
2152
2153
  >
2153
2154
  <ap-checkbox ?checked=${g}></ap-checkbox>
2154
2155
  <span>${p}</span>
@@ -2158,7 +2159,7 @@
2158
2159
  </div>
2159
2160
  `:o.nothing}
2160
2161
  </div>
2161
- `}_renderDateFilter(t){var u,f;const e=w(t),s=this._datePresets[e]||"",i=this._getApplied(e),r=this._isSpecialValue(i.values)?((u=i.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],c=this._dateFroms[e]?new Date(this._dateFroms[e]).toISOString().split("T")[0]:"",d=this._dateTos[e]?new Date(this._dateTos[e]).toISOString().split("T")[0]:"",h=["before","after","between"].includes(r);return o.html`
2162
+ `}_renderDateFilter(t){var u,f;const e=k(t),s=this._datePresets[e]||"",i=this._getApplied(e),r=this._isSpecialValue(i.values)?((u=i.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],l=this._dateFroms[e]?new Date(this._dateFroms[e]).toISOString().split("T")[0]:"",d=this._dateTos[e]?new Date(this._dateTos[e]).toISOString().split("T")[0]:"",h=["before","after","between"].includes(r);return o.html`
2162
2163
  <div class="filter-content" style="position: relative;">
2163
2164
  <button
2164
2165
  class="clear-btn"
@@ -2177,7 +2178,7 @@
2177
2178
 
2178
2179
  <ap-radio-group
2179
2180
  columns="2"
2180
- .options=${Ft}
2181
+ .options=${Pt}
2181
2182
  .value=${r!=="empty"&&r!=="non-empty"?r:""}
2182
2183
  @ap-change=${p=>this._onDatePreset(t,p.detail.value)}
2183
2184
  ></ap-radio-group>
@@ -2202,7 +2203,7 @@
2202
2203
  <input
2203
2204
  type="date"
2204
2205
  class="filter-input"
2205
- .value=${c}
2206
+ .value=${l}
2206
2207
  @change=${p=>this._onDateInput(t,"from",p)}
2207
2208
  />
2208
2209
  </div>
@@ -2212,7 +2213,7 @@
2212
2213
  <input
2213
2214
  type="date"
2214
2215
  class="filter-input"
2215
- .value=${c}
2216
+ .value=${l}
2216
2217
  @change=${p=>this._onDateInput(t,"from",p)}
2217
2218
  />
2218
2219
  </div>
@@ -2230,7 +2231,7 @@
2230
2231
  </div>
2231
2232
  `:o.nothing}
2232
2233
  </div>
2233
- `}_renderGeoFilter(t){var u,f;const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let r="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,v]=p.split("..");r=g||"",n=v||""}const c=r.length>0,d=r.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2234
+ `}_renderGeoFilter(t){var u,f;const e=k(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let r="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,m]=p.split("..");r=g||"",n=m||""}const l=r.length>0,d=r.split(",").map(p=>p.trim()),h=!l||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2234
2235
  <div class="filter-content" style="position: relative;">
2235
2236
  <button
2236
2237
  class="clear-btn"
@@ -2241,13 +2242,13 @@
2241
2242
  <div class="filter-section">
2242
2243
  <span class="section-label">Content</span>
2243
2244
  <ap-radio-group
2244
- .options=${xt}
2245
+ .options=${Ft}
2245
2246
  .value=${a}
2246
2247
  @ap-change=${p=>this._onContentModeChange(t,p.detail.value)}
2247
2248
  ></ap-radio-group>
2248
2249
  </div>
2249
2250
 
2250
- ${a===he?o.html`
2251
+ ${a===me?o.html`
2251
2252
  <div class="filter-section">
2252
2253
  <div class="geo-row">
2253
2254
  <div class="geo-location">
@@ -2259,7 +2260,7 @@
2259
2260
  .value=${r}
2260
2261
  @change=${p=>this._onGeoLocationInput(t,p)}
2261
2262
  />
2262
- ${c&&!h?o.html`<div class="error-text">Enter coordinates as "latitude, longitude"</div>`:o.nothing}
2263
+ ${l&&!h?o.html`<div class="error-text">Enter coordinates as "latitude, longitude"</div>`:o.nothing}
2263
2264
  </div>
2264
2265
  <div class="geo-radius">
2265
2266
  <span class="input-label">Max radius (&deg;)</span>
@@ -2276,7 +2277,7 @@
2276
2277
  </div>
2277
2278
  `:o.nothing}
2278
2279
  </div>
2279
- `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(w(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
2280
+ `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(k(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
2280
2281
  <div class="filter-content" style="position: relative;">
2281
2282
  <button
2282
2283
  class="clear-btn"
@@ -2286,13 +2287,13 @@
2286
2287
 
2287
2288
  <div class="filter-section">
2288
2289
  <ap-radio-group
2289
- .options=${ge}
2290
+ .options=${be}
2290
2291
  .value=${s}
2291
2292
  @ap-change=${r=>this._onEmptyOption(t,r.detail.value)}
2292
2293
  ></ap-radio-group>
2293
2294
  </div>
2294
2295
  </div>
2295
- `}_renderFaceMatcherFilter(t){const e=w(t),s=this._getApplied(e),i=s.values||[],a=s.operator||y.IS;return o.html`
2296
+ `}_renderFaceMatcherFilter(t){const e=k(t),s=this._getApplied(e),i=s.values||[],a=s.operator||w.IS;return o.html`
2296
2297
  <div class="filter-content" style="position: relative;">
2297
2298
  <button
2298
2299
  class="clear-btn"
@@ -2304,7 +2305,7 @@
2304
2305
  <span class="section-label">Condition</span>
2305
2306
  <ap-radio-group
2306
2307
  direction="horizontal"
2307
- .options=${X}
2308
+ .options=${ee}
2308
2309
  .value=${a}
2309
2310
  @ap-change=${r=>this._emitFilterChange(t,r.detail.value,i)}
2310
2311
  ></ap-radio-group>
@@ -2313,7 +2314,7 @@
2313
2314
  type="text"
2314
2315
  placeholder="Search faces"
2315
2316
  .value=${i.join(", ")}
2316
- @change=${r=>{const c=r.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._emitFilterChange(t,a,c)}}
2317
+ @change=${r=>{const l=r.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._emitFilterChange(t,a,l)}}
2317
2318
  />
2318
2319
  </div>
2319
2320
  </div>
@@ -2329,7 +2330,7 @@
2329
2330
  name="chevron-right"
2330
2331
  .size=${14}
2331
2332
  ></ap-icon>
2332
- <ap-icon name=${Je[e.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
2333
+ <ap-icon name=${ot[e.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
2333
2334
  <span>${e.label}</span>
2334
2335
  </div>
2335
2336
  <div class="field-header-actions">
@@ -2348,16 +2349,16 @@
2348
2349
  </div>
2349
2350
  `}_renderSelectorMode(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,r)=>r.length===0?o.nothing:o.html`
2350
2351
  <div class="field-group-label">${a}</div>
2351
- ${r.map(n=>{const c=w(n),d=this.visibleFields.includes(c),h=!!this.appliedMetadata[c]||!!this.appliedFilters[c],u=this.pinnedFields.includes(c),f=!d&&this._atFieldLimit;return o.html`
2352
+ ${r.map(n=>{const l=k(n),d=this.visibleFields.includes(l),h=!!this.appliedMetadata[l]||!!this.appliedFilters[l],u=this.pinnedFields.includes(l),f=!d&&this._atFieldLimit;return o.html`
2352
2353
  <div
2353
2354
  class="field-item ${h?"has-filter":""} ${f?"disabled":""}"
2354
2355
  @click=${()=>!f&&this._emitFieldSelect(n)}
2355
2356
  >
2356
- <ap-icon name=${Je[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
2357
+ <ap-icon name=${ot[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
2357
2358
  <span class="field-item-label">${n.label}</span>
2358
2359
  <button
2359
2360
  class="field-item-pin ${u?"pinned":""}"
2360
- @click=${p=>{p.stopPropagation(),this._emitPin(c,!u)}}
2361
+ @click=${p=>{p.stopPropagation(),this._emitPin(l,!u)}}
2361
2362
  title=${u?"Unpin field":"Pin field"}
2362
2363
  >
2363
2364
  <ap-icon name="pin" .size=${12}></ap-icon>
@@ -2400,7 +2401,7 @@
2400
2401
  </button>
2401
2402
  `:o.nothing}
2402
2403
  `:o.nothing}
2403
- `}};A.styles=[J,te,o.css`
2404
+ `}};A.styles=[W,oe,o.css`
2404
2405
  /* ── Field selection panel ─────────────────────────────── */
2405
2406
 
2406
2407
  .add-field-btn {
@@ -2777,7 +2778,7 @@
2777
2778
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
2778
2779
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
2779
2780
  }
2780
- `];T([l.property({type:Array})],A.prototype,"fields",2);T([l.property({type:Object})],A.prototype,"appliedFilters",2);T([l.property({type:Array})],A.prototype,"visibleFields",2);T([l.property()],A.prototype,"mode",2);T([l.property()],A.prototype,"activeFieldKey",2);T([l.property({type:Array})],A.prototype,"pinnedFields",2);T([l.property({type:Object})],A.prototype,"appliedMetadata",2);T([l.property({attribute:!1})],A.prototype,"apiClient",2);T([l.state()],A.prototype,"_showFieldSelection",2);T([l.state()],A.prototype,"_fieldSearch",2);T([l.state()],A.prototype,"_collapsedFields",2);T([l.state()],A.prototype,"_tagInputs",2);T([l.state()],A.prototype,"_tagSuggestions",2);T([l.state()],A.prototype,"_tagLoading",2);T([l.state()],A.prototype,"_datePresets",2);T([l.state()],A.prototype,"_dateFroms",2);T([l.state()],A.prototype,"_dateTos",2);T([l.state()],A.prototype,"_specificModeFields",2);T([l.state()],A.prototype,"_selectSearches",2);A=T([l.customElement("ap-filter-metadata")],A);var _i=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,G=(t,e,s,i)=>{for(var a=i>1?void 0:i?yi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_i(e,s,a),a};let V=class extends o.LitElement{constructor(){super(...arguments),this.selectedStatus=[],this.statusOperator=":=",this.approverValue="",this.approverOperator="~",this.requesterValue="",this.requesterOperator="~",this.dueDatePreset="",this.dueDateFrom="",this.dueDateTo=""}get _hasAnySelection(){return this.selectedStatus.length>0||!!this.approverValue||!!this.requesterValue||!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo}get _statusHasEmptyValue(){return this.selectedStatus.includes(U)||this.selectedStatus.includes(B)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===U||t===B)}get _dueDateNeedsInputs(){return["before","after","between","specific"].includes(this.dueDatePreset)}_toggleStatus(t){const e=this.selectedStatus.includes(t)?this.selectedStatus.filter(s=>s!==t):[...this.selectedStatus,t];this._emitChange(z.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(z.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(z.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(z.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(z.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(z.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(z.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(z.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(z.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(z.DUE_DATE,s?[s]:[],":")}_handleDueDateFrom(t){const e=t.target.value;this._emitDateChange(e,this.dueDateTo)}_handleDueDateTo(t){const e=t.target.value;this._emitDateChange(this.dueDateFrom,e)}_clearDueDate(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:z.DUE_DATE,values:[],operator:":"},bubbles:!0,composed:!0}))}_emitDateChange(t,e){const s=[];t&&s.push(t),e&&s.push(e),this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:z.DUE_DATE,values:s,operator:t&&e?"..":t?">=":"<="},bubbles:!0,composed:!0}))}_emitChange(t,e,s){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:t,values:e,operator:s},bubbles:!0,composed:!0}))}_renderStatusSection(){const t=this.selectedStatus.length>0;return o.html`
2781
+ `];M([c.property({type:Array})],A.prototype,"fields",2);M([c.property({type:Object})],A.prototype,"appliedFilters",2);M([c.property({type:Array})],A.prototype,"visibleFields",2);M([c.property()],A.prototype,"mode",2);M([c.property()],A.prototype,"activeFieldKey",2);M([c.property({type:Array})],A.prototype,"pinnedFields",2);M([c.property({type:Object})],A.prototype,"appliedMetadata",2);M([c.property({attribute:!1})],A.prototype,"apiClient",2);M([c.state()],A.prototype,"_showFieldSelection",2);M([c.state()],A.prototype,"_fieldSearch",2);M([c.state()],A.prototype,"_collapsedFields",2);M([c.state()],A.prototype,"_tagInputs",2);M([c.state()],A.prototype,"_tagSuggestions",2);M([c.state()],A.prototype,"_tagLoading",2);M([c.state()],A.prototype,"_datePresets",2);M([c.state()],A.prototype,"_dateFroms",2);M([c.state()],A.prototype,"_dateTos",2);M([c.state()],A.prototype,"_specificModeFields",2);M([c.state()],A.prototype,"_selectSearches",2);A=M([c.customElement("ap-filter-metadata")],A);var ka=Object.defineProperty,Sa=Object.getOwnPropertyDescriptor,Q=(t,e,s,i)=>{for(var a=i>1?void 0:i?Sa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ka(e,s,a),a};let q=class extends o.LitElement{constructor(){super(...arguments),this.selectedStatus=[],this.statusOperator=":=",this.approverValue="",this.approverOperator="~",this.requesterValue="",this.requesterOperator="~",this.dueDatePreset="",this.dueDateFrom="",this.dueDateTo=""}get _hasAnySelection(){return this.selectedStatus.length>0||!!this.approverValue||!!this.requesterValue||!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo}get _statusHasEmptyValue(){return this.selectedStatus.includes(U)||this.selectedStatus.includes(V)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===U||t===V)}get _dueDateNeedsInputs(){return["before","after","between","specific"].includes(this.dueDatePreset)}_toggleStatus(t){const e=this.selectedStatus.includes(t)?this.selectedStatus.filter(s=>s!==t):[...this.selectedStatus,t];this._emitChange(R.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(R.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(R.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(R.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(R.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(R.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(R.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(R.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(R.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(R.DUE_DATE,s?[s]:[],":")}_handleDueDateFrom(t){const e=t.target.value;this._emitDateChange(e,this.dueDateTo)}_handleDueDateTo(t){const e=t.target.value;this._emitDateChange(this.dueDateFrom,e)}_clearDueDate(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:R.DUE_DATE,values:[],operator:":"},bubbles:!0,composed:!0}))}_emitDateChange(t,e){const s=[];t&&s.push(t),e&&s.push(e),this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:R.DUE_DATE,values:s,operator:t&&e?"..":t?">=":"<="},bubbles:!0,composed:!0}))}_emitChange(t,e,s){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:t,values:e,operator:s},bubbles:!0,composed:!0}))}_renderStatusSection(){const t=this.selectedStatus.length>0;return o.html`
2781
2782
  <div class="filter-section">
2782
2783
  <button
2783
2784
  class="clear-btn"
@@ -2791,7 +2792,7 @@
2791
2792
  <span class="section-label condition-label">Condition</span>
2792
2793
  <ap-radio-group
2793
2794
  direction="horizontal"
2794
- .options=${sa}
2795
+ .options=${li}
2795
2796
  .value=${this.statusOperator}
2796
2797
  ?disabled=${this._statusHasOnlyEmptyValues}
2797
2798
  @ap-change=${this._handleStatusOperator}
@@ -2799,7 +2800,7 @@
2799
2800
 
2800
2801
  <!-- Empty / Not empty checkboxes -->
2801
2802
  <div class="options-list short mt-12">
2802
- ${ge.map(e=>o.html`
2803
+ ${be.map(e=>o.html`
2803
2804
  <ap-checkbox
2804
2805
  ?checked=${this.selectedStatus.includes(e.value)}
2805
2806
  @ap-toggle=${()=>this._toggleStatus(e.value)}
@@ -2811,7 +2812,7 @@
2811
2812
 
2812
2813
  <!-- Status options -->
2813
2814
  <div class="options-list short">
2814
- ${aa.map(e=>o.html`
2815
+ ${ci.map(e=>o.html`
2815
2816
  <ap-checkbox
2816
2817
  ?checked=${this.selectedStatus.includes(e.value)}
2817
2818
  @ap-toggle=${()=>this._toggleStatus(e.value)}
@@ -2838,7 +2839,7 @@
2838
2839
  <span class="section-label condition-label">Condition</span>
2839
2840
  <ap-radio-group
2840
2841
  direction="horizontal"
2841
- .options=${Kt}
2842
+ .options=${Wt}
2842
2843
  .value=${this.approverOperator}
2843
2844
  @ap-change=${this._handleApproverOperator}
2844
2845
  ></ap-radio-group>
@@ -2865,7 +2866,7 @@
2865
2866
  <span class="section-label condition-label">Condition</span>
2866
2867
  <ap-radio-group
2867
2868
  direction="horizontal"
2868
- .options=${Kt}
2869
+ .options=${Wt}
2869
2870
  .value=${this.requesterOperator}
2870
2871
  @ap-change=${this._handleRequesterOperator}
2871
2872
  ></ap-radio-group>
@@ -2890,8 +2891,8 @@
2890
2891
 
2891
2892
  <!-- Empty / Not empty radio buttons -->
2892
2893
  <ap-radio-group
2893
- .options=${ge}
2894
- .value=${this.dueDatePreset===U||this.dueDatePreset===B?this.dueDatePreset:""}
2894
+ .options=${be}
2895
+ .value=${this.dueDatePreset===U||this.dueDatePreset===V?this.dueDatePreset:""}
2895
2896
  @ap-change=${this._handleDueDatePreset}
2896
2897
  ></ap-radio-group>
2897
2898
 
@@ -2900,8 +2901,8 @@
2900
2901
  <!-- Date range options -->
2901
2902
  <ap-radio-group
2902
2903
  columns="2"
2903
- .options=${Js}
2904
- .value=${this.dueDatePreset!==U&&this.dueDatePreset!==B?this.dueDatePreset:""}
2904
+ .options=${ri}
2905
+ .value=${this.dueDatePreset!==U&&this.dueDatePreset!==V?this.dueDatePreset:""}
2905
2906
  @ap-change=${this._handleDueDatePreset}
2906
2907
  ></ap-radio-group>
2907
2908
 
@@ -2943,7 +2944,7 @@
2943
2944
  <div class="separator"></div>
2944
2945
  ${this._renderDueDateSection()}
2945
2946
  </div>
2946
- `}};V.styles=[J,te,o.css`
2947
+ `}};q.styles=[W,oe,o.css`
2947
2948
  .options-list.short {
2948
2949
  max-height: none;
2949
2950
  }
@@ -2962,7 +2963,7 @@
2962
2963
  .mt-12 {
2963
2964
  margin-top: 12px;
2964
2965
  }
2965
- `];G([l.property({type:Array})],V.prototype,"selectedStatus",2);G([l.property()],V.prototype,"statusOperator",2);G([l.property()],V.prototype,"approverValue",2);G([l.property()],V.prototype,"approverOperator",2);G([l.property()],V.prototype,"requesterValue",2);G([l.property()],V.prototype,"requesterOperator",2);G([l.property()],V.prototype,"dueDatePreset",2);G([l.property()],V.prototype,"dueDateFrom",2);G([l.property()],V.prototype,"dueDateTo",2);V=G([l.customElement("ap-filter-approval")],V);var xi=Object.defineProperty,wi=Object.getOwnPropertyDescriptor,Y=(t,e,s,i)=>{for(var a=i>1?void 0:i?wi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xi(e,s,a),a};const $i=300;function ki(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let q=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=ki(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.PRODUCT_REF,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(i=>i!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},$i)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
2966
+ `];Q([c.property({type:Array})],q.prototype,"selectedStatus",2);Q([c.property()],q.prototype,"statusOperator",2);Q([c.property()],q.prototype,"approverValue",2);Q([c.property()],q.prototype,"approverOperator",2);Q([c.property()],q.prototype,"requesterValue",2);Q([c.property()],q.prototype,"requesterOperator",2);Q([c.property()],q.prototype,"dueDatePreset",2);Q([c.property()],q.prototype,"dueDateFrom",2);Q([c.property()],q.prototype,"dueDateTo",2);q=Q([c.customElement("ap-filter-approval")],q);var Ca=Object.defineProperty,Ea=Object.getOwnPropertyDescriptor,Z=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ea(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ca(e,s,a),a};const Fa=300;function Aa(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let H=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=Aa(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.PRODUCT_REF,values:e,operator:w.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(i=>i!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},Fa)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
2966
2967
  `).map(e=>e.trim()).filter(e=>e!=="");if(t.length>0){const e=new Set(this.selected),s=[...this.selected,...t.filter(i=>!e.has(i))];this._emit(s)}this._closeAddList()}_renderProductItem(t){const e=this.selected.includes(t);return o.html`
2967
2968
  <div
2968
2969
  class="product-item"
@@ -3082,7 +3083,7 @@
3082
3083
  </div>
3083
3084
  </div>
3084
3085
  `:o.nothing}
3085
- `}};q.styles=[J,te,o.css`
3086
+ `}};H.styles=[W,oe,o.css`
3086
3087
  .product-item {
3087
3088
  display: flex;
3088
3089
  align-items: center;
@@ -3321,7 +3322,7 @@
3321
3322
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
3322
3323
  margin-left: 4px;
3323
3324
  }
3324
- `];Y([l.property({type:Array})],q.prototype,"selected",2);Y([l.property({attribute:!1})],q.prototype,"apiClient",2);Y([l.query(".product-search")],q.prototype,"_searchInput",2);Y([l.state()],q.prototype,"_search",2);Y([l.state()],q.prototype,"_debouncedSearch",2);Y([l.state()],q.prototype,"_products",2);Y([l.state()],q.prototype,"_isLoading",2);Y([l.state()],q.prototype,"_showAddList",2);Y([l.state()],q.prototype,"_addListText",2);q=Y([l.customElement("ap-filter-product-ref")],q);var Si=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,E=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ci(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Si(e,s,a),a};let C=class extends o.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=At,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(r=>{var n;return r instanceof HTMLElement&&r.classList.contains("chip")&&((n=r.closest)==null?void 0:n.call(r,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(a=>a instanceof HTMLElement?a.classList.contains("popover-anchor")||a.classList.contains("popover-panel"):!1),i=(this._showDropdown||this._showMetadataSelector)&&e.some(a=>a instanceof HTMLElement&&(a.classList.contains("dropdown-menu")||a.classList.contains("filter-dropdown")||a.classList.contains("metadata-selector-overlay")));s||i||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),i=s?s.offsetWidth:this.offsetWidth,a=e.offsetWidth;this._externalLeft+a>i-8&&(e.style.left=`${Math.max(8,i-a-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}openFilterPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this._showMetadataSelector=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_handleSortOpen(){this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:i}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:i},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,this._showDropdown=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${dt[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=Ct.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,i,a;const e=this.filters.applied;switch(t){case"type":{const r=e.type;return o.html`<ap-filter-type
3325
+ `];Z([c.property({type:Array})],H.prototype,"selected",2);Z([c.property({attribute:!1})],H.prototype,"apiClient",2);Z([c.query(".product-search")],H.prototype,"_searchInput",2);Z([c.state()],H.prototype,"_search",2);Z([c.state()],H.prototype,"_debouncedSearch",2);Z([c.state()],H.prototype,"_products",2);Z([c.state()],H.prototype,"_isLoading",2);Z([c.state()],H.prototype,"_showAddList",2);Z([c.state()],H.prototype,"_addListText",2);H=Z([c.customElement("ap-filter-product-ref")],H);var Ta=Object.defineProperty,Ma=Object.getOwnPropertyDescriptor,F=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ma(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ta(e,s,a),a};let E=class extends o.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=It,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(r=>{var n;return r instanceof HTMLElement&&r.classList.contains("chip")&&((n=r.closest)==null?void 0:n.call(r,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(a=>a instanceof HTMLElement?a.classList.contains("popover-anchor")||a.classList.contains("popover-panel"):!1),i=(this._showDropdown||this._showMetadataSelector)&&e.some(a=>a instanceof HTMLElement&&(a.classList.contains("dropdown-menu")||a.classList.contains("filter-dropdown")||a.classList.contains("metadata-selector-overlay")));s||i||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),i=s?s.offsetWidth:this.offsetWidth,a=e.offsetWidth;this._externalLeft+a>i-8&&(e.style.left=`${Math.max(8,i-a-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}openFilterPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this._showMetadataSelector=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_handleSortOpen(){this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:i}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:i},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,this._showDropdown=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${ft[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=Lt.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,i,a;const e=this.filters.applied;switch(t){case"type":{const r=e.type;return o.html`<ap-filter-type
3325
3326
  .selected=${(r==null?void 0:r.values)||[]}
3326
3327
  @filter-change=${this._handleFilterChange}
3327
3328
  ></ap-filter-type>`}case"tags":{const r=e.tags;return o.html`<ap-filter-tags
@@ -3351,7 +3352,7 @@
3351
3352
  .to=${(r==null?void 0:r.to)||""}
3352
3353
  .preset=${(r==null?void 0:r.preset)||""}
3353
3354
  @filter-change=${this._handleFilterChange}
3354
- ></ap-filter-date>`}case"size":{const r=e.size,n=((s=r==null?void 0:r.values)==null?void 0:s[0])||"",[c,d]=n.split(".."),h=c?parseFloat(c)/1e6:0,u=d?parseFloat(d)/1e6:0;return o.html`<ap-filter-size
3355
+ ></ap-filter-date>`}case"size":{const r=e.size,n=((s=r==null?void 0:r.values)==null?void 0:s[0])||"",[l,d]=n.split(".."),h=l?parseFloat(l)/1e6:0,u=d?parseFloat(d)/1e6:0;return o.html`<ap-filter-size
3355
3356
  .min=${h}
3356
3357
  .max=${u}
3357
3358
  @filter-change=${this._handleFilterChange}
@@ -3360,13 +3361,13 @@
3360
3361
  .selectedOrientation=${(n==null?void 0:n.orientation)||[]}
3361
3362
  .selectedFaces=${(n==null?void 0:n.faces)||[]}
3362
3363
  @filter-change=${this._handleFilterChange}
3363
- ></ap-filter-image>`}case"approval":{const r=e.approval_status,n=e.task_approver,c=e.task_requester,d=e.task_duedate;return o.html`<ap-filter-approval
3364
+ ></ap-filter-image>`}case"approval":{const r=e.approval_status,n=e.task_approver,l=e.task_requester,d=e.task_duedate;return o.html`<ap-filter-approval
3364
3365
  .selectedStatus=${(r==null?void 0:r.values)||[]}
3365
3366
  .statusOperator=${(r==null?void 0:r.operator)||":"}
3366
3367
  .approverValue=${((i=n==null?void 0:n.values)==null?void 0:i[0])||""}
3367
3368
  .approverOperator=${(n==null?void 0:n.operator)||":"}
3368
- .requesterValue=${((a=c==null?void 0:c.values)==null?void 0:a[0])||""}
3369
- .requesterOperator=${(c==null?void 0:c.operator)||":"}
3369
+ .requesterValue=${((a=l==null?void 0:l.values)==null?void 0:a[0])||""}
3370
+ .requesterOperator=${(l==null?void 0:l.operator)||":"}
3370
3371
  .dueDatePreset=${(d==null?void 0:d.preset)||""}
3371
3372
  .dueDateFrom=${(d==null?void 0:d.from)||""}
3372
3373
  .dueDateTo=${(d==null?void 0:d.to)||""}
@@ -3448,7 +3449,7 @@
3448
3449
  </button>
3449
3450
  ${this._showDropdown?o.html`
3450
3451
  <div class="dropdown-menu">
3451
- ${Ct.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3452
+ ${Lt.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3452
3453
  </div>
3453
3454
  `:o.nothing}
3454
3455
  </div>
@@ -3487,7 +3488,7 @@
3487
3488
  ${this._getMetadataFieldLabel(this._openMetadataField)}
3488
3489
  `:o.html`
3489
3490
  <ap-icon name=${this._getFilterIcon(this._openFilter)} .size=${16}></ap-icon>
3490
- ${ke[this._openFilter]||this._openFilter}
3491
+ ${Te[this._openFilter]||this._openFilter}
3491
3492
  `}
3492
3493
  <button class="anchor-close" @click=${()=>{this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}} title="Close">
3493
3494
  <ap-icon name="close" .size=${14}></ap-icon>
@@ -3499,7 +3500,7 @@
3499
3500
  </div>
3500
3501
  </div>
3501
3502
  `:o.nothing}
3502
- `}};C.styles=o.css`
3503
+ `}};E.styles=o.css`
3503
3504
  :host {
3504
3505
  display: block;
3505
3506
  padding: 8px 20px 6px;
@@ -3537,6 +3538,7 @@
3537
3538
  display: flex;
3538
3539
  align-items: center;
3539
3540
  gap: 0;
3541
+ min-width: 0;
3540
3542
  }
3541
3543
 
3542
3544
  /* Filter dropdown trigger */
@@ -3819,6 +3821,7 @@
3819
3821
  z-index: 50;
3820
3822
  width: 360px;
3821
3823
  max-height: 400px;
3824
+ overflow-x: hidden;
3822
3825
  overflow-y: auto;
3823
3826
  overscroll-behavior: contain;
3824
3827
  background: var(--ap-card, oklch(1 0 0));
@@ -3835,10 +3838,10 @@
3835
3838
  border-radius: 8px;
3836
3839
  top: 0;
3837
3840
  }
3838
- `;E([l.property({type:Number})],C.prototype,"totalCount",2);E([l.property({type:Number})],C.prototype,"totalFolderCount",2);E([l.property({type:Boolean})],C.prototype,"isLoading",2);E([l.property({type:Boolean})],C.prototype,"showUpload",2);E([l.property()],C.prototype,"sortBy",2);E([l.property()],C.prototype,"sortDirection",2);E([l.property({type:Array})],C.prototype,"sortOptions",2);E([l.property({type:Object})],C.prototype,"filters",2);E([l.property({type:Array})],C.prototype,"labels",2);E([l.property({type:Array})],C.prototype,"tags",2);E([l.property({type:Array})],C.prototype,"metadataFields",2);E([l.property({type:Array})],C.prototype,"pinnedFilters",2);E([l.property({type:Array})],C.prototype,"forcedFilterKeys",2);E([l.property({attribute:!1})],C.prototype,"apiClient",2);E([l.query("ap-dropdown")],C.prototype,"_sortDropdown",2);E([l.state()],C.prototype,"_showDropdown",2);E([l.state()],C.prototype,"_showMetadataSelector",2);E([l.state()],C.prototype,"_openFilter",2);E([l.state()],C.prototype,"_openMetadataField",2);E([l.state()],C.prototype,"_externalTrigger",2);E([l.state()],C.prototype,"_externalLeft",2);E([l.state()],C.prototype,"_externalTop",2);C=E([l.customElement("ap-content-toolbar")],C);var Ei=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,R=(t,e,s,i)=>{for(var a=i>1?void 0:i?Fi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ei(e,s,a),a};let P=class extends o.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var e;return((e=as.find(s=>s.value===t))==null?void 0:e.label)||t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,i]=e.split(".."),a=s?parseFloat(s):null,r=i?parseFloat(i):null,n=c=>c>=1e3?`${(c/1e3).toFixed(c%1e3===0?0:1)} GB`:`${c} MB`;return a!==null&&r!==null?`${n(a)} – ${n(r)}`:a!==null?`> ${n(a)}`:r!==null?`< ${n(r)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===m.SIZE)return this._getSizeSummary(s);if(e===m.COLOR){const a=s.values.map(r=>r.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===m.TYPE?a=>this._mapTypeLabel(a):e===m.TAGS?a=>{var r;return((r=this.tags.find(n=>n.sid===a))==null?void 0:r.label)||a}:e===m.LABELS?a=>{var r;return((r=this.labels.find(n=>n.sid===a))==null?void 0:r.name)||a}:a=>a;return s.values.length===1?i(s.values[0]):`${i(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,i=[...s.resolution,...s.orientation,...s.faces];return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}return""}_getDateSummary(t){var n,c;const e=((n=is.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...Ft,...rs],i=t.preset?((c=s.find(d=>d.value===t.preset))==null?void 0:c.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let r="";switch(t.kind){case"preset":r=i;break;case"before":r=t.to?`Before ${a(t.to)}`:i;break;case"after":r=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?r=`${a(t.from)} – ${a(t.to)}`:t.from?r=`After ${a(t.from)}`:t.to&&(r=`Before ${a(t.to)}`);break;case"specific":r=t.from?a(t.from):"";break;default:r=i}return r?`${e}: ${r}`:""}_getFilterIcon(t){var e;return((e=Ct.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return(s==null?void 0:s.label)||e}_getMetadataIcon(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return s&&Je[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of Jt)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
3841
+ `;F([c.property({type:Number})],E.prototype,"totalCount",2);F([c.property({type:Number})],E.prototype,"totalFolderCount",2);F([c.property({type:Boolean})],E.prototype,"isLoading",2);F([c.property({type:Boolean})],E.prototype,"showUpload",2);F([c.property()],E.prototype,"sortBy",2);F([c.property()],E.prototype,"sortDirection",2);F([c.property({type:Array})],E.prototype,"sortOptions",2);F([c.property({type:Object})],E.prototype,"filters",2);F([c.property({type:Array})],E.prototype,"labels",2);F([c.property({type:Array})],E.prototype,"tags",2);F([c.property({type:Array})],E.prototype,"metadataFields",2);F([c.property({type:Array})],E.prototype,"pinnedFilters",2);F([c.property({type:Array})],E.prototype,"forcedFilterKeys",2);F([c.property({attribute:!1})],E.prototype,"apiClient",2);F([c.query("ap-dropdown")],E.prototype,"_sortDropdown",2);F([c.state()],E.prototype,"_showDropdown",2);F([c.state()],E.prototype,"_showMetadataSelector",2);F([c.state()],E.prototype,"_openFilter",2);F([c.state()],E.prototype,"_openMetadataField",2);F([c.state()],E.prototype,"_externalTrigger",2);F([c.state()],E.prototype,"_externalLeft",2);F([c.state()],E.prototype,"_externalTop",2);E=F([c.customElement("ap-content-toolbar")],E);var La=Object.defineProperty,Oa=Object.getOwnPropertyDescriptor,j=(t,e,s,i)=>{for(var a=i>1?void 0:i?Oa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&La(e,s,a),a};let D=class extends o.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var e;return((e=ls.find(s=>s.value===t))==null?void 0:e.label)||t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,i]=e.split(".."),a=s?parseFloat(s):null,r=i?parseFloat(i):null,n=l=>l>=1e3?`${(l/1e3).toFixed(l%1e3===0?0:1)} GB`:`${l} MB`;return a!==null&&r!==null?`${n(a)} – ${n(r)}`:a!==null?`> ${n(a)}`:r!==null?`< ${n(r)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===v.SIZE)return this._getSizeSummary(s);if(e===v.COLOR){const a=s.values.map(r=>r.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===v.TYPE?a=>this._mapTypeLabel(a):e===v.TAGS?a=>{var r;return((r=this.tags.find(n=>n.sid===a))==null?void 0:r.label)||a}:e===v.LABELS?a=>{var r;return((r=this.labels.find(n=>n.sid===a))==null?void 0:r.name)||a}:a=>a;return s.values.length===1?i(s.values[0]):`${i(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,i=[...s.resolution,...s.orientation,...s.faces];return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}return""}_getDateSummary(t){var n,l;const e=((n=cs.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...Pt,...ds],i=t.preset?((l=s.find(d=>d.value===t.preset))==null?void 0:l.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let r="";switch(t.kind){case"preset":r=i;break;case"before":r=t.to?`Before ${a(t.to)}`:i;break;case"after":r=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?r=`${a(t.from)} – ${a(t.to)}`:t.from?r=`After ${a(t.from)}`:t.to&&(r=`Before ${a(t.to)}`);break;case"specific":r=t.from?a(t.from):"";break;default:r=i}return r?`${e}: ${r}`:""}_getFilterIcon(t){var e;return((e=Lt.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return(s==null?void 0:s.label)||e}_getMetadataIcon(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return s&&ot[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of as)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
3839
3842
  <span class="chip forced">
3840
- ${(i||t===m.TYPE||t===m.SIZE)&&s?o.html`<span class="chip-label">${s}</span>`:o.html`
3841
- <span class="chip-label">${ke[t]||t}</span>
3843
+ ${(i||t===v.TYPE||t===v.SIZE)&&s?o.html`<span class="chip-label">${s}</span>`:o.html`
3844
+ <span class="chip-label">${Te[t]||t}</span>
3842
3845
  ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
3843
3846
  `}
3844
3847
  <span class="chip-lock">
@@ -3848,15 +3851,15 @@
3848
3851
  `}_renderFilterChip(t,e){if(!e)return o.html`
3849
3852
  <span class="chip pinned-empty ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
3850
3853
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
3851
- <span class="chip-label">${ke[t]||t}</span>
3854
+ <span class="chip-label">${Te[t]||t}</span>
3852
3855
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
3853
3856
  </span>
3854
3857
  `;const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
3855
3858
  <span class="chip ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
3856
- ${(i||t===m.TYPE||t===m.SIZE)&&s?o.html`
3859
+ ${(i||t===v.TYPE||t===v.SIZE)&&s?o.html`
3857
3860
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
3858
3861
  <span class="chip-label">${s}</span>`:o.html`
3859
- <span class="chip-label">${ke[t]||t}</span>
3862
+ <span class="chip-label">${Te[t]||t}</span>
3860
3863
  ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
3861
3864
  `}
3862
3865
  <button class="chip-remove" @click=${a=>{a.stopPropagation(),this._removeFilter(t)}} title="Remove filter">
@@ -3864,7 +3867,7 @@
3864
3867
  </button>
3865
3868
  </span>
3866
3869
  `}_renderMetadataChip(t,e){if(!e){const r=this._getMetadataLabel(t),n=this._getMetadataIcon(t);return o.html`
3867
- <span class="chip pinned-empty ${t===this.activeMetadataField?"active":""}" @click=${c=>this._openMetadataFilter(t,c)}>
3870
+ <span class="chip pinned-empty ${t===this.activeMetadataField?"active":""}" @click=${l=>this._openMetadataFilter(t,l)}>
3868
3871
  <span class="chip-icon"><ap-icon name=${n} .size=${16}></ap-icon></span>
3869
3872
  <span class="chip-label">${r}</span>
3870
3873
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
@@ -3878,17 +3881,17 @@
3878
3881
  <ap-icon name="close" .size=${12}></ap-icon>
3879
3882
  </button>
3880
3883
  </span>
3881
- `}render(){const t=De(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(g=>!e.has(g)),i=Object.keys(this.appliedMetadata),a=new Set(this.pinnedFilters),r=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),c=s.filter(g=>!a.has(g)),d=i.filter(g=>!r.has(g)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!r.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),f=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+c.length+d.length+(h?1:0)+(u?1:0)===0?o.nothing:o.html`
3884
+ `}render(){const t=He(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(g=>!e.has(g)),i=Object.keys(this.appliedMetadata),a=new Set(this.pinnedFilters),r=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),l=s.filter(g=>!a.has(g)),d=i.filter(g=>!r.has(g)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!r.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),f=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+l.length+d.length+(h?1:0)+(u?1:0)===0?o.nothing:o.html`
3882
3885
  <div class="chips-row">
3883
3886
  <div class="chips">
3884
3887
  ${[...e].map(g=>this._renderForcedChip(g,t[g]))}
3885
3888
  ${n.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
3886
3889
  ${this.pinnedMetadataFields.map(g=>this._renderMetadataChip(g,this.appliedMetadata[g]))}
3887
- ${c.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
3890
+ ${l.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
3888
3891
  ${h?o.html`
3889
3892
  <span class="chip pinned-empty active pending" @click=${g=>this._openFilter(this.pendingFilter,g)}>
3890
3893
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(this.pendingFilter)} .size=${16}></ap-icon></span>
3891
- <span class="chip-label">${ke[this.pendingFilter]||this.pendingFilter}</span>
3894
+ <span class="chip-label">${Te[this.pendingFilter]||this.pendingFilter}</span>
3892
3895
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
3893
3896
  </span>
3894
3897
  `:o.nothing}
@@ -3903,7 +3906,7 @@
3903
3906
  ${f?o.html`<button class="clear-all" @click=${this._clearAll}>Clear filters</button>`:o.nothing}
3904
3907
  </div>
3905
3908
  </div>
3906
- `}};P.styles=o.css`
3909
+ `}};D.styles=o.css`
3907
3910
  :host {
3908
3911
  display: block;
3909
3912
  }
@@ -4050,43 +4053,71 @@
4050
4053
  align-items: center;
4051
4054
  opacity: 0.6;
4052
4055
  }
4053
- `;R([l.property({type:Object})],P.prototype,"appliedFilters",2);R([l.property({type:Object})],P.prototype,"appliedMetadata",2);R([l.property({type:Object})],P.prototype,"forcedFilters",2);R([l.property({type:Array})],P.prototype,"metadataFields",2);R([l.property({type:Array})],P.prototype,"pinnedFilters",2);R([l.property({type:Array})],P.prototype,"pinnedMetadataFields",2);R([l.property({type:Array})],P.prototype,"tags",2);R([l.property({type:Array})],P.prototype,"labels",2);R([l.property()],P.prototype,"activeFilter",2);R([l.property()],P.prototype,"activeMetadataField",2);R([l.property()],P.prototype,"pendingFilter",2);R([l.property()],P.prototype,"pendingMetadataField",2);P=R([l.customElement("ap-filters-bar")],P);var Ai=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,xe=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ti(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ai(e,s,a),a};const Mi=6;let Z=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.isLoading=!1,this.multiSelect=!0,this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){return o.html`
4054
- <div class="grid" role="list" aria-label="Assets">
4055
- ${this.folders.map(t=>o.html`
4056
+ `;j([c.property({type:Object})],D.prototype,"appliedFilters",2);j([c.property({type:Object})],D.prototype,"appliedMetadata",2);j([c.property({type:Object})],D.prototype,"forcedFilters",2);j([c.property({type:Array})],D.prototype,"metadataFields",2);j([c.property({type:Array})],D.prototype,"pinnedFilters",2);j([c.property({type:Array})],D.prototype,"pinnedMetadataFields",2);j([c.property({type:Array})],D.prototype,"tags",2);j([c.property({type:Array})],D.prototype,"labels",2);j([c.property()],D.prototype,"activeFilter",2);j([c.property()],D.prototype,"activeMetadataField",2);j([c.property()],D.prototype,"pendingFilter",2);j([c.property()],D.prototype,"pendingMetadataField",2);D=j([c.customElement("ap-filters-bar")],D);var Pa=Object.defineProperty,Ia=Object.getOwnPropertyDescriptor,J=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ia(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Pa(e,s,a),a};const Da=6;let K=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.gridSize="normal",this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){const t=this.gridSize==="large"?"280px":"220px";return o.html`
4057
+ <div class="grid" role="list" aria-label="Assets" style="--ap-grid-min-col: ${t}">
4058
+ ${this.folders.map((e,s)=>o.html`
4056
4059
  <ap-folder-card
4057
- .folder=${t}
4058
- .previews=${this.folderPreviews[t.uuid]||[]}
4059
- @folder-open=${e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-open",{detail:e.detail,bubbles:!0,composed:!0}))}}
4060
+ .folder=${e}
4061
+ .previews=${this.folderPreviews[e.uuid]||[]}
4062
+ .selectable=${this.folderSelectable}
4063
+ ?selected=${this.selectedFolderIds.includes(e.uuid)}
4064
+ .index=${s}
4065
+ data-folder-uuid=${e.uuid}
4066
+ @folder-open=${i=>{i.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-open",{detail:i.detail,bubbles:!0,composed:!0}))}}
4067
+ @folder-select=${i=>{i.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:i.detail,bubbles:!0,composed:!0}))}}
4060
4068
  ></ap-folder-card>
4061
4069
  `)}
4062
- ${this.assets.map((t,e)=>{const s=e>=this._prevCount?Math.min(e-this._prevCount,20):Math.min(e,20);return o.html`
4070
+ ${this.assets.map((e,s)=>{const i=s>=this._prevCount?Math.min(s-this._prevCount,20):Math.min(s,20);return o.html`
4063
4071
  <ap-asset-card
4064
- .asset=${t}
4065
- .index=${e}
4066
- ?selected=${this.selectedIds.includes(t.uuid)}
4072
+ .asset=${e}
4073
+ .index=${this.folderSelectable?this.folders.length+s:s}
4074
+ ?selected=${this.selectedIds.includes(e.uuid)}
4067
4075
  .multiSelect=${this.multiSelect}
4068
- style="--ap-stagger-index: ${s}"
4069
- data-asset-uuid=${t.uuid}
4070
- @asset-select=${i=>this.dispatchEvent(new CustomEvent("asset-select",{detail:i.detail,bubbles:!0,composed:!0}))}
4071
- @asset-preview=${i=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:i.detail,bubbles:!0,composed:!0}))}
4072
- @asset-quick-select=${i=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:i.detail,bubbles:!0,composed:!0}))}
4076
+ style="--ap-stagger-index: ${i}"
4077
+ data-asset-uuid=${e.uuid}
4078
+ @asset-select=${a=>this.dispatchEvent(new CustomEvent("asset-select",{detail:a.detail,bubbles:!0,composed:!0}))}
4079
+ @asset-preview=${a=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:a.detail,bubbles:!0,composed:!0}))}
4080
+ @asset-quick-select=${a=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:a.detail,bubbles:!0,composed:!0}))}
4073
4081
  ></ap-asset-card>
4074
4082
  `})}
4075
- ${this.isLoading?Array.from({length:Mi},()=>o.html`<div class="ghost-card"></div>`):o.nothing}
4083
+ ${this.isLoading?Array.from({length:Da},()=>o.html`<div class="ghost-card">
4084
+ <div class="ghost-thumb"></div>
4085
+ <div class="ghost-info">
4086
+ <div class="ghost-line ghost-name"></div>
4087
+ <div class="ghost-line ghost-meta"></div>
4088
+ </div>
4089
+ </div>`):o.nothing}
4076
4090
  </div>
4077
- `}};Z.styles=o.css`
4091
+ `}};K.styles=o.css`
4078
4092
  :host {
4079
4093
  display: block;
4080
4094
  padding: 0 20px 16px;
4081
4095
  }
4082
4096
  .grid {
4083
4097
  display: grid;
4084
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
4098
+ grid-template-columns: repeat(auto-fill, minmax(var(--ap-grid-min-col, 220px), 1fr));
4085
4099
  gap: 24px;
4086
4100
  }
4087
4101
  .ghost-card {
4088
- aspect-ratio: 6/4;
4089
4102
  border-radius: var(--ap-radius, 8px);
4103
+ overflow: hidden;
4104
+ }
4105
+ .ghost-thumb {
4106
+ aspect-ratio: 6/4;
4107
+ background: linear-gradient(
4108
+ 90deg,
4109
+ var(--ap-muted, oklch(0.974 0.006 239.819)) 25%,
4110
+ #e8e8ea 50%,
4111
+ var(--ap-muted, oklch(0.974 0.006 239.819)) 75%
4112
+ );
4113
+ background-size: 200% 100%;
4114
+ animation: shimmer 1.5s infinite;
4115
+ }
4116
+ .ghost-info {
4117
+ padding: 10px 12px;
4118
+ }
4119
+ .ghost-line {
4120
+ border-radius: 4px;
4090
4121
  background: linear-gradient(
4091
4122
  90deg,
4092
4123
  var(--ap-muted, oklch(0.974 0.006 239.819)) 25%,
@@ -4096,17 +4127,26 @@
4096
4127
  background-size: 200% 100%;
4097
4128
  animation: shimmer 1.5s infinite;
4098
4129
  }
4130
+ .ghost-name {
4131
+ height: 14px;
4132
+ width: 70%;
4133
+ }
4134
+ .ghost-meta {
4135
+ height: 12px;
4136
+ width: 50%;
4137
+ margin-top: 6px;
4138
+ }
4099
4139
  @keyframes shimmer {
4100
4140
  0% { background-position: 200% 0; }
4101
4141
  100% { background-position: -200% 0; }
4102
4142
  }
4103
4143
  @media (prefers-reduced-motion: reduce) {
4104
- .ghost-card { animation: none; }
4144
+ .ghost-thumb, .ghost-line { animation: none; }
4105
4145
  }
4106
- `;xe([l.property({type:Array})],Z.prototype,"assets",2);xe([l.property({type:Array})],Z.prototype,"folders",2);xe([l.property({type:Object})],Z.prototype,"folderPreviews",2);xe([l.property({type:Array})],Z.prototype,"selectedIds",2);xe([l.property({type:Boolean})],Z.prototype,"isLoading",2);xe([l.property({type:Boolean})],Z.prototype,"multiSelect",2);Z=xe([l.customElement("ap-grid-view")],Z);var Oi=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,le=(t,e,s,i)=>{for(var a=i>1?void 0:i?Li(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Oi(e,s,a),a};const Pi=5;let K=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.isLoading=!1,this.multiSelect=!0,this.totalCount=0,this.isSelectingAll=!1}get _allVisibleSelected(){if(this.assets.length===0||this.selectedIds.length===0)return!1;const t=new Set(this.selectedIds);return this.assets.every(e=>t.has(e.uuid))}_handleHeaderCheckboxClick(){this.isSelectingAll||(this._allVisibleSelected&&this.selectedIds.length>=this.totalCount?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0})))}render(){const t=this._allVisibleSelected&&this.selectedIds.length>=this.totalCount;return o.html`
4107
- <div class="list-header ${this.multiSelect?"has-checkbox":""}" role="row" aria-label="Column headers">
4146
+ `;J([c.property({type:Array})],K.prototype,"assets",2);J([c.property({type:Array})],K.prototype,"folders",2);J([c.property({type:Object})],K.prototype,"folderPreviews",2);J([c.property({type:Array})],K.prototype,"selectedIds",2);J([c.property({type:Array})],K.prototype,"selectedFolderIds",2);J([c.property({type:Boolean})],K.prototype,"isLoading",2);J([c.property({type:Boolean})],K.prototype,"multiSelect",2);J([c.property({type:Boolean})],K.prototype,"folderSelectable",2);J([c.property({type:String})],K.prototype,"gridSize",2);K=J([c.customElement("ap-grid-view")],K);var za=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,G=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ra(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&za(e,s,a),a};const Na=5;let N=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.totalCount=0,this.isSelectingAll=!1,this.folderPreviews={},this._compactLevel=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(t=>{var i;const e=((i=t[0])==null?void 0:i.contentRect.width)??0,s=e<550?2:e<680?1:0;s!==this._compactLevel&&(this._compactLevel=s)}),this._resizeObserver.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._resizeObserver)==null||t.disconnect()}_getGridColumns(t){const e=[];return t&&e.push("32px"),e.push("48px"),e.push("minmax(120px, 1fr)"),e.push("72px"),this._compactLevel<2&&e.push("100px"),this._compactLevel<1&&e.push("120px"),e.push("36px"),e.join(" ")}get _allVisibleSelected(){if(this.assets.length===0&&this.folders.length===0||this.selectedIds.length===0&&this.selectedFolderIds.length===0)return!1;const t=new Set(this.selectedIds),e=this.assets.length===0||this.assets.every(a=>t.has(a.uuid));if(!this.folderSelectable)return e&&this.assets.length>0;const s=new Set(this.selectedFolderIds),i=this.folders.length===0||this.folders.every(a=>s.has(a.uuid));return e&&i}_handleHeaderCheckboxClick(){if(this.isSelectingAll)return;const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length;this._allVisibleSelected&&e>=t?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0}))}render(){const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length,s=this._allVisibleSelected&&e>=t;return o.html`
4147
+ <div class="list-header" style="grid-template-columns: ${this._getGridColumns(this.multiSelect)}" role="row" aria-label="Column headers">
4108
4148
  ${this.multiSelect?o.html`<span class="header-checkbox" @click=${this._handleHeaderCheckboxClick}>
4109
- <div class="header-check-box ${t?"checked":this.selectedIds.length>0?"indeterminate":""}">
4149
+ <div class="header-check-box ${s?"checked":e>0?"indeterminate":""}">
4110
4150
  <svg class="header-check-icon check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
4111
4151
  <path d="M20 6 9 17l-5-5"></path>
4112
4152
  </svg>
@@ -4118,38 +4158,55 @@
4118
4158
  <span></span>
4119
4159
  <span>Name</span>
4120
4160
  <span>Type</span>
4121
- <span>Size</span>
4122
- <span>Date</span>
4161
+ ${this._compactLevel<2?o.html`<span>Size</span>`:o.nothing}
4162
+ ${this._compactLevel<1?o.html`<span>Date</span>`:o.nothing}
4123
4163
  <span></span>
4124
4164
  </div>
4125
4165
  <div class="list-body" role="list" aria-label="Assets">
4126
- ${this.folders.map(e=>o.html`
4166
+ ${this.folders.map((i,a)=>o.html`
4127
4167
  <ap-folder-row
4128
- .folder=${e}
4129
- @folder-open=${s=>{s.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-open",{detail:s.detail,bubbles:!0,composed:!0}))}}
4168
+ .folder=${i}
4169
+ .previews=${this.folderPreviews[i.uuid]||[]}
4170
+ .selectable=${this.folderSelectable}
4171
+ .compactLevel=${this._compactLevel}
4172
+ ?selected=${this.selectedFolderIds.includes(i.uuid)}
4173
+ .index=${a}
4174
+ data-folder-uuid=${i.uuid}
4175
+ @folder-open=${r=>{r.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-open",{detail:r.detail,bubbles:!0,composed:!0}))}}
4176
+ @folder-select=${r=>{r.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:r.detail,bubbles:!0,composed:!0}))}}
4130
4177
  ></ap-folder-row>
4131
4178
  `)}
4132
- ${this.assets.map((e,s)=>o.html`
4179
+ ${this.assets.map((i,a)=>o.html`
4133
4180
  <ap-asset-row
4134
- .asset=${e}
4135
- .index=${s}
4136
- ?selected=${this.selectedIds.includes(e.uuid)}
4181
+ .asset=${i}
4182
+ .index=${this.folderSelectable?this.folders.length+a:a}
4183
+ ?selected=${this.selectedIds.includes(i.uuid)}
4137
4184
  .multiSelect=${this.multiSelect}
4138
- data-asset-uuid=${e.uuid}
4139
- @asset-select=${i=>this.dispatchEvent(new CustomEvent("asset-select",{detail:i.detail,bubbles:!0,composed:!0}))}
4140
- @asset-preview=${i=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:i.detail,bubbles:!0,composed:!0}))}
4185
+ .compactLevel=${this._compactLevel}
4186
+ data-asset-uuid=${i.uuid}
4187
+ @asset-select=${r=>this.dispatchEvent(new CustomEvent("asset-select",{detail:r.detail,bubbles:!0,composed:!0}))}
4188
+ @asset-preview=${r=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:r.detail,bubbles:!0,composed:!0}))}
4141
4189
  ></ap-asset-row>
4142
4190
  `)}
4143
- ${this.isLoading?Array.from({length:Pi},()=>o.html`<div class="ghost-row"></div>`):o.nothing}
4191
+ ${this.isLoading?Array.from({length:Na},(i,a)=>{const r=["70%","55%","80%","45%","65%"];return o.html`
4192
+ <div class="ghost-row" style="grid-template-columns: ${this._getGridColumns(this.multiSelect)}">
4193
+ ${this.multiSelect?o.html`<div class="ghost-el ghost-check"></div>`:o.nothing}
4194
+ <div class="ghost-el ghost-thumb"></div>
4195
+ <div class="ghost-el ghost-name" style="width: ${r[a]}"></div>
4196
+ <div class="ghost-el ghost-type"></div>
4197
+ ${this._compactLevel<2?o.html`<div class="ghost-el ghost-size"></div>`:o.nothing}
4198
+ ${this._compactLevel<1?o.html`<div class="ghost-el ghost-date"></div>`:o.nothing}
4199
+ <div></div>
4200
+ </div>
4201
+ `}):o.nothing}
4144
4202
  </div>
4145
- `}};K.styles=o.css`
4203
+ `}};N.styles=o.css`
4146
4204
  :host {
4147
4205
  display: block;
4148
4206
  padding: 0 20px 16px;
4149
4207
  }
4150
4208
  .list-header {
4151
4209
  display: grid;
4152
- grid-template-columns: 32px 48px 1fr 100px 200px 120px 60px;
4153
4210
  gap: 12px;
4154
4211
  padding: 8px 12px;
4155
4212
  font-size: 14px;
@@ -4157,8 +4214,10 @@
4157
4214
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
4158
4215
  border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
4159
4216
  }
4160
- .list-header:not(.has-checkbox) {
4161
- grid-template-columns: 48px 1fr 100px 200px 120px 60px;
4217
+ .list-header span {
4218
+ white-space: nowrap;
4219
+ overflow: hidden;
4220
+ text-overflow: ellipsis;
4162
4221
  }
4163
4222
  .header-checkbox {
4164
4223
  display: flex;
@@ -4198,9 +4257,13 @@
4198
4257
  flex-direction: column;
4199
4258
  }
4200
4259
  .ghost-row {
4201
- height: 56px;
4202
- margin-bottom: 1px;
4203
- border-radius: 4px;
4260
+ display: grid;
4261
+ gap: 12px;
4262
+ padding: 8px 12px;
4263
+ align-items: center;
4264
+ border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
4265
+ }
4266
+ .ghost-el {
4204
4267
  background: linear-gradient(
4205
4268
  90deg,
4206
4269
  var(--ap-muted, oklch(0.974 0.006 239.819)) 25%,
@@ -4209,28 +4272,35 @@
4209
4272
  );
4210
4273
  background-size: 200% 100%;
4211
4274
  animation: shimmer 1.5s infinite;
4275
+ border-radius: 4px;
4212
4276
  }
4277
+ .ghost-check { width: 22px; height: 22px; }
4278
+ .ghost-thumb { width: 40px; height: 40px; }
4279
+ .ghost-name { height: 14px; border-radius: 4px; }
4280
+ .ghost-type { height: 12px; width: 40px; }
4281
+ .ghost-size { height: 12px; width: 48px; }
4282
+ .ghost-date { height: 12px; width: 72px; }
4213
4283
  @keyframes shimmer {
4214
4284
  0% { background-position: 200% 0; }
4215
4285
  100% { background-position: -200% 0; }
4216
4286
  }
4217
4287
  @media (prefers-reduced-motion: reduce) {
4218
- .ghost-row { animation: none; }
4288
+ .ghost-el { animation: none; }
4219
4289
  }
4220
- `;le([l.property({type:Array})],K.prototype,"assets",2);le([l.property({type:Array})],K.prototype,"folders",2);le([l.property({type:Array})],K.prototype,"selectedIds",2);le([l.property({type:Boolean})],K.prototype,"isLoading",2);le([l.property({type:Boolean})],K.prototype,"multiSelect",2);le([l.property({type:Number})],K.prototype,"totalCount",2);le([l.property({type:Boolean})],K.prototype,"isSelectingAll",2);K=le([l.customElement("ap-list-view")],K);function st(t){var i;const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||(e==null?void 0:e.preview)||((i=t.url)==null?void 0:i.cdn)||"";return Fe(s)}function fs(t){const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||"";return s?Fe(s):""}function Ot(t){var s,i;let e=Fe(((s=t.url)==null?void 0:s.cdn)||((i=t.url)==null?void 0:i.public)||"");return e?(e=e.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),ze(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function ze(t,e){try{const s=new URL(t);for(const[i,a]of Object.entries(e))s.searchParams.set(i,a);return s.toString()}catch{return t}}const Zt=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Fe(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(Zt);if(s){const i=s[2];return t.replace(Zt,`$1assets.filerobot.com/${i}/`)}if(e)try{const i=new URL(t);return`https://assets.filerobot.com/${e}${i.pathname}${i.search}`}catch{}return t}function Lt(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,i=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,i)).toFixed(i===0?0:1)} ${e[i]}`}function at(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function ms(t,e){return!t||!e?"":`${t} x ${e}`}const Ii=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif"]),Di=new Set([...Ii,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function Se(t){if(!t)return"other";const e={image:"image",video:"video",audio:"audio",application:"document",font:"font",text:"document"};return e[t]?e[t]:t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/pdf")||t.startsWith("text/")||t.startsWith("application/msword")||t.startsWith("application/vnd.")?"document":t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z")||t.startsWith("application/gzip")?"archive":t.startsWith("font/")?"font":"other"}function vs(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Di.has(e)}const bs="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",zi={png:"PNG",jpg:"JPG",jpeg:"JPG",gif:"GIF",bmp:"BMP",webp:"WEBP",svg:"SVG",tiff:"TIFF",tif:"TIFF",heic:"HEIC",avif:"AVIF",ico:"ICO",pdf:"PDF",doc:"DOC",docx:"DOCX",txt:"TXT",rtf:"RTF",xls:"XLS",xlsx:"XLSX",ppt:"PPT",pptx:"PPTX",csv:"CSV",odt:"ODT",ods:"ODS",odp:"ODP",mp4:"MP4",webm:"WEBM",mov:"MOV",avi:"AVI",mkv:"MKV",mpeg:"MPEG",mp3:"MP3",wav:"WAV",aac:"AAC",flac:"FLAC",ogg:"OGG",wma:"WMA",zip:"ZIP",rar:"RAR","7z":"7Z",tar:"TAR",gz:"GZ",ttf:"TTF",otf:"OTF",woff:"WOFF",woff2:"WOFF2",eot:"EOT",psd:"PSD",ai:"AI",dwg:"DWG",js:"JS",ts:"TS",css:"CSS",html:"HTML",json:"JSON",xml:"XML",php:"PHP",sh:"SH",exe:"EXE",iso:"ISO",bin:"BIN"};function ut(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=zi[e];return`${bs}${s||"DEFAULT"}.png`}function je(){return`${bs}DEFAULT.png`}function St(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const Ri=new Set(["png","svg","webp","gif","avif"]);function Pt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ri.has(e)}var Ni=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,He=(t,e,s,i)=>{for(var a=i>1?void 0:i?ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ni(e,s,a),a};let ve=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.stopPropagation(),t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_formatDuration(t){const e=Math.floor(t/3600),s=Math.floor(t%3600/60),i=Math.floor(t%60),a=r=>String(r).padStart(2,"0");return e>0?`${e}:${a(s)}:${a(i)}`:`${a(s)}:${a(i)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u,f,p;const t=this.asset;if(!t)return o.html``;const s=Se(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=vs(t.extension||"");let r="";s?r=fs(t):i?r=Ot(t):a&&(r=st(t));const n=ut(t.extension||""),c=Pt(t.extension||"");return o.html`
4290
+ `;G([c.property({type:Array})],N.prototype,"assets",2);G([c.property({type:Array})],N.prototype,"folders",2);G([c.property({type:Array})],N.prototype,"selectedIds",2);G([c.property({type:Array})],N.prototype,"selectedFolderIds",2);G([c.property({type:Boolean})],N.prototype,"isLoading",2);G([c.property({type:Boolean})],N.prototype,"multiSelect",2);G([c.property({type:Boolean})],N.prototype,"folderSelectable",2);G([c.property({type:Number})],N.prototype,"totalCount",2);G([c.property({type:Boolean})],N.prototype,"isSelectingAll",2);G([c.property({type:Object})],N.prototype,"folderPreviews",2);G([c.state()],N.prototype,"_compactLevel",2);N=G([c.customElement("ap-list-view")],N);const ja=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif"]),Ba=new Set([...ja,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function Me(t){if(!t)return"other";const e={image:"image",video:"video",audio:"audio",application:"document",font:"font",text:"document"};return e[t]?e[t]:t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/pdf")||t.startsWith("text/")||t.startsWith("application/msword")||t.startsWith("application/vnd.")?"document":t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z")||t.startsWith("application/gzip")?"archive":t.startsWith("font/")?"font":"other"}function ys(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ba.has(e)}const xs="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",Ua={png:"PNG",jpg:"JPG",jpeg:"JPG",gif:"GIF",bmp:"BMP",webp:"WEBP",svg:"SVG",tiff:"TIFF",tif:"TIFF",heic:"HEIC",avif:"AVIF",ico:"ICO",pdf:"PDF",doc:"DOC",docx:"DOCX",txt:"TXT",rtf:"RTF",xls:"XLS",xlsx:"XLSX",ppt:"PPT",pptx:"PPTX",csv:"CSV",odt:"ODT",ods:"ODS",odp:"ODP",mp4:"MP4",webm:"WEBM",mov:"MOV",avi:"AVI",mkv:"MKV",mpeg:"MPEG",mp3:"MP3",wav:"WAV",aac:"AAC",flac:"FLAC",ogg:"OGG",wma:"WMA",zip:"ZIP",rar:"RAR","7z":"7Z",tar:"TAR",gz:"GZ",ttf:"TTF",otf:"OTF",woff:"WOFF",woff2:"WOFF2",eot:"EOT",psd:"PSD",ai:"AI",dwg:"DWG",js:"JS",ts:"TS",css:"CSS",html:"HTML",json:"JSON",xml:"XML",php:"PHP",sh:"SH",exe:"EXE",iso:"ISO",bin:"BIN"};function Ze(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=Ua[e];return`${xs}${s||"DEFAULT"}.png`}function Pe(){return`${xs}DEFAULT.png`}function bt(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const Va=new Set(["png","svg","webp","gif","avif"]);function Rt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Va.has(e)}const qa=new Set(["svg","svg+xml","png","pdf"]);function ws(t){return qa.has(bt(t).toLowerCase())}function ct(t){var i;const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||(e==null?void 0:e.preview)||((i=t.url)==null?void 0:i.cdn)||"";return Ie(s)}function $s(t){const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||"";return s?Ie(s):""}function Nt(t){var s,i;let e=Ie(((s=t.url)==null?void 0:s.cdn)||((i=t.url)==null?void 0:i.public)||"");return e?(e=e.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),Ke(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function Ke(t,e){try{const s=new URL(t);for(const[i,a]of Object.entries(e))s.searchParams.set(i,a);return s.toString()}catch{return t}}const is=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Ie(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(is);if(s){const i=s[2];return t.replace(is,`$1assets.filerobot.com/${i}/`)}if(e)try{const i=new URL(t);return`https://assets.filerobot.com/${e}${i.pathname}${i.search}`}catch{}return t}function ks(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=Ie(s);const a=Me(t.file_type),r=String(window.devicePixelRatio||1);return a==="video"?Ke(i,{w:e,dpr:r,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||bt(t.file_type).toLowerCase()==="pdf"?(i=i.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),Ke(i,{w:e,dpr:r,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):Ke(i,{w:e,dpr:r})}function jt(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,i=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,i)).toFixed(i===0?0:1)} ${e[i]}`}function dt(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Ss(t,e){return!t||!e?"":`${t} x ${e}`}var Ha=Object.defineProperty,Ka=Object.getOwnPropertyDescriptor,Je=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ka(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ha(e,s,a),a};let xe=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.stopPropagation(),t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_formatDuration(t){const e=Math.floor(t/3600),s=Math.floor(t%3600/60),i=Math.floor(t%60),a=r=>String(r).padStart(2,"0");return e>0?`${e}:${a(s)}:${a(i)}`:`${a(s)}:${a(i)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u,f,p;const t=this.asset;if(!t)return o.html``;const s=Me(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=ys(t.extension||"");let r="";s?r=$s(t):i?r=Nt(t):a&&(r=ct(t));const n=Ze(t.extension||""),l=Rt(t.extension||"");return o.html`
4221
4291
  <div class="card" @click=${this._handleSelect}>
4222
- <div class="thumbnail ${c&&r?"chess":""}">
4292
+ <div class="thumbnail ${l&&r?"chess":""}">
4223
4293
  ${r?o.html`<img
4224
4294
  src=${r}
4225
4295
  alt=${t.name}
4226
4296
  loading="lazy"
4227
- class="thumb-img ${c?"transparent-asset":""}"
4228
- @error=${g=>{const v=g.target,x=je();v.src!==n&&v.src!==x?(v.src=n,v.classList.add("icon-fallback")):v.src!==x&&(v.src=x)}}
4297
+ class="thumb-img ${l?"transparent-asset":""}"
4298
+ @error=${g=>{const m=g.target,y=Pe();m.src!==n&&m.src!==y?(m.src=n,m.classList.add("icon-fallback")):m.src!==y&&(m.src=y)}}
4229
4299
  />`:o.html`<img
4230
4300
  src=${n}
4231
4301
  alt=${t.name}
4232
4302
  class="thumb-img icon-fallback"
4233
- @error=${g=>{const v=g.target,x=je();v.src!==x&&(v.src=x)}}
4303
+ @error=${g=>{const m=g.target,y=Pe();m.src!==y&&(m.src=y)}}
4234
4304
  />`}
4235
4305
  ${s&&(((h=t.info)==null?void 0:h.video_duration)??((u=t.info)==null?void 0:u.duration))!=null?o.html`<span class="duration">${this._formatDuration(t.info.video_duration??t.info.duration)}</span>`:o.nothing}
4236
4306
  <div class="overlay">
@@ -4255,10 +4325,10 @@
4255
4325
  </div>
4256
4326
  <div class="info">
4257
4327
  <div class="name" title=${t.name}>${t.name}</div>
4258
- <div class="meta">${(f=t.extension)==null?void 0:f.toUpperCase()}${(()=>{var b,k,$,F;const g=((b=t.info)==null?void 0:b.img_w)||((k=t.info)==null?void 0:k.video_w),v=(($=t.info)==null?void 0:$.img_h)||((F=t.info)==null?void 0:F.video_h),x=ms(g,v);return x?` · ${x}`:""})()} · ${Lt(((p=t.size)==null?void 0:p.bytes)||0)}</div>
4328
+ <div class="meta">${(f=t.extension)==null?void 0:f.toUpperCase()}${(()=>{var x,S,b,C;const g=((x=t.info)==null?void 0:x.img_w)||((S=t.info)==null?void 0:S.video_w),m=((b=t.info)==null?void 0:b.img_h)||((C=t.info)==null?void 0:C.video_h),y=Ss(g,m);return y?` · ${y}`:""})()} · ${jt(((p=t.size)==null?void 0:p.bytes)||0)}</div>
4259
4329
  </div>
4260
4330
  </div>
4261
- `}};ve.styles=o.css`
4331
+ `}};xe.styles=o.css`
4262
4332
  :host {
4263
4333
  display: block;
4264
4334
  animation: ap-card-in 300ms ease-out both;
@@ -4437,8 +4507,8 @@
4437
4507
  :host { animation: none; }
4438
4508
  .overlay { transition: none; }
4439
4509
  }
4440
- `;He([l.property({type:Object})],ve.prototype,"asset",2);He([l.property({type:Number})],ve.prototype,"index",2);He([l.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);He([l.property({type:Boolean})],ve.prototype,"multiSelect",2);ve=He([l.customElement("ap-asset-card")],ve);var Ui=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Ke=(t,e,s,i)=>{for(var a=i>1?void 0:i?Bi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ui(e,s,a),a};let be=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u;const t=this.asset;if(!t)return o.html``;const s=Se(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=vs(t.extension||"");let r="";s?r=fs(t):i?r=Ot(t):a&&(r=st(t));const n=ut(t.extension||""),c=Pt(t.extension||"");return o.html`
4441
- <div class="row" @click=${this._handleSelect}>
4510
+ `;Je([c.property({type:Object})],xe.prototype,"asset",2);Je([c.property({type:Number})],xe.prototype,"index",2);Je([c.property({type:Boolean,reflect:!0})],xe.prototype,"selected",2);Je([c.property({type:Boolean})],xe.prototype,"multiSelect",2);xe=Je([c.customElement("ap-asset-card")],xe);var Ga=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,je=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ya(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ga(e,s,a),a};let de=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("36px"),t.join(" ")}_handleSelect(t){if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u;const t=this.asset;if(!t)return o.html``;const s=Me(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=ys(t.extension||"");let r="";s?r=$s(t):i?r=Nt(t):a&&(r=ct(t));const n=Ze(t.extension||""),l=Rt(t.extension||"");return o.html`
4511
+ <div class="row" style="grid-template-columns: ${this._getGridColumns()}" @click=${this._handleSelect}>
4442
4512
  ${this.multiSelect?o.html`
4443
4513
  <div class="check">
4444
4514
  <div class="check-box">
@@ -4448,37 +4518,36 @@
4448
4518
  </div>
4449
4519
  </div>
4450
4520
  `:o.nothing}
4451
- <div class="thumb ${c&&r?"chess":""}">
4521
+ <div class="thumb ${l&&r?"chess":""}">
4452
4522
  ${r?o.html`<img
4453
4523
  src=${r}
4454
4524
  alt=${t.name}
4455
- class="${c?"transparent-asset":""}"
4525
+ class="${l?"transparent-asset":""}"
4456
4526
  loading="lazy"
4457
- @error=${f=>{const p=f.target,g=je();p.src!==n&&p.src!==g?(p.src=n,p.classList.add("icon-fallback")):p.src!==g&&(p.src=g)}}
4527
+ @error=${f=>{const p=f.target,g=Pe();p.src!==n&&p.src!==g?(p.src=n,p.classList.add("icon-fallback")):p.src!==g&&(p.src=g)}}
4458
4528
  />`:o.html`<img
4459
4529
  src=${n}
4460
4530
  alt=${t.name}
4461
4531
  class="icon-fallback"
4462
- @error=${f=>{const p=f.target,g=je();p.src!==g&&(p.src=g)}}
4532
+ @error=${f=>{const p=f.target,g=Pe();p.src!==g&&(p.src=g)}}
4463
4533
  />`}
4464
4534
  </div>
4465
4535
  <div class="name" title=${t.name}>${t.name}</div>
4466
4536
  <div class="type">${(h=t.extension)==null?void 0:h.toUpperCase()}</div>
4467
- <div class="desc">${Lt(((u=t.size)==null?void 0:u.bytes)||0)}</div>
4468
- <div class="date">${at(t.created_at||"")}</div>
4537
+ ${this.compactLevel<2?o.html`<div class="desc">${jt(((u=t.size)==null?void 0:u.bytes)||0)}</div>`:o.nothing}
4538
+ ${this.compactLevel<1?o.html`<div class="date">${dt(t.created_at||"")}</div>`:o.nothing}
4469
4539
  <div class="actions">
4470
4540
  <button class="icon-btn" @click=${this._handlePreview} aria-label="Preview">
4471
4541
  <ap-icon name="preview" .size=${16}></ap-icon>
4472
4542
  </button>
4473
4543
  </div>
4474
4544
  </div>
4475
- `}};be.styles=o.css`
4545
+ `}};de.styles=o.css`
4476
4546
  :host {
4477
4547
  display: block;
4478
4548
  }
4479
4549
  .row {
4480
4550
  display: grid;
4481
- grid-template-columns: 32px 48px 1fr 100px 200px 120px 60px;
4482
4551
  gap: 12px;
4483
4552
  padding: 8px 12px;
4484
4553
  align-items: center;
@@ -4600,14 +4669,14 @@
4600
4669
  :host([selected]) .check-icon {
4601
4670
  display: block;
4602
4671
  }
4603
- `;Ke([l.property({type:Object})],be.prototype,"asset",2);Ke([l.property({type:Number})],be.prototype,"index",2);Ke([l.property({type:Boolean,reflect:!0})],be.prototype,"selected",2);Ke([l.property({type:Boolean})],be.prototype,"multiSelect",2);be=Ke([l.customElement("ap-asset-row")],be);var Vi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,It=(t,e,s,i)=>{for(var a=i>1?void 0:i?qi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Vi(e,s,a),a};let Ue=class extends o.LitElement{constructor(){super(...arguments),this.previews=[]}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_isAlternativeDisplay(t){const e=St(t).toLowerCase();return["svg","svg+xml","png","pdf"].includes(e)}_getPreviewUrl(t){const e=t.file_uri_cdn;if(!e)return"";let s=Fe(e);const i=Se(t.file_type),a=String(window.devicePixelRatio||1);return i==="video"?ze(s,{w:"200",dpr:a,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||St(t.file_type).toLowerCase()==="pdf"?(s=s.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),ze(s,{w:"200",dpr:a,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):ze(s,{w:"200",dpr:a})}_renderPreviewImg(t){const e=this._isAlternativeDisplay(t.file_type),s=this._getPreviewUrl(t),i=ut(St(t.file_type)),a=je();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4672
+ `;je([c.property({type:Object})],de.prototype,"asset",2);je([c.property({type:Number})],de.prototype,"index",2);je([c.property({type:Boolean,reflect:!0})],de.prototype,"selected",2);je([c.property({type:Boolean})],de.prototype,"multiSelect",2);je([c.property({type:Number})],de.prototype,"compactLevel",2);de=je([c.customElement("ap-asset-row")],de);var Xa=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Be=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Xa(e,s,a),a};let pe=class extends o.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.index=0}_handleClick(t){if(!this.selectable){this._handleOpen();return}if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){t.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:{folder:this.folder,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0,composed:!0}));return}this._handleOpen()}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_getPreviewUrl(t){return ks(t,"200")}_renderPreviewImg(t){const e=ws(t.file_type),s=this._getPreviewUrl(t),i=Ze(bt(t.file_type)),a=Pe();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4604
4673
  <img
4605
4674
  class="preview-img ${e?"icon-mode":""}"
4606
4675
  src="${s||i}"
4607
4676
  alt=""
4608
4677
  loading="lazy"
4609
- @error=${r=>{const n=r.target,c=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
4610
- @load=${r=>{const n=r.target,c=n.parentElement;n.src.includes("scaleflex/assets/file-types")&&(n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
4678
+ @error=${r=>{const n=r.target,l=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg"))}}
4679
+ @load=${r=>{const n=r.target,l=n.parentElement;n.src.includes("scaleflex/assets/file-types")&&(n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg"))}}
4611
4680
  />
4612
4681
  </div>`}_renderPreviews(){if(this.previews.length===0)return o.html`<div class="empty-preview"><ap-icon name="inbox" .size=${64}></ap-icon></div>`;const t=this.previews.slice(0,3);return t.length===1?o.html`<div class="preview-left">${this._renderPreviewImg(t[0])}</div>`:o.html`
4613
4682
  <div class="preview-grid">
@@ -4618,19 +4687,26 @@
4618
4687
  </div>
4619
4688
  </div>
4620
4689
  `}render(){var a,r;const t=this.folder;if(!t)return o.html``;const e=((a=t.count)==null?void 0:a.files_direct)??0,i=(((r=t.count)==null?void 0:r.files_recursive)??0)-e;return o.html`
4621
- <div class="card" @click=${this._handleOpen}>
4690
+ <div class="card" @click=${this._handleClick}>
4622
4691
  <!-- Folder shape background -->
4623
4692
  <svg class="folder-svg" viewBox="0 0 100 100" preserveAspectRatio="none">
4624
4693
  <path d="M 3,0 L 30,0 L 43.5,0 Q 45,0 46.5,3 L 51,12 L 97,12 Q 100,12 100,15 L 100,97 Q 100,100 97,100 L 3,100 Q 0,100 0,97 L 0,3 Q 0,0 3,0 Z"
4625
- fill="#E3E8ED" rx="3" ry="3" />
4694
+ rx="3" ry="3" />
4626
4695
  </svg>
4696
+ ${this.selectable?o.html`
4697
+ <div class="check">
4698
+ <div class="check-box">
4699
+ <svg class="check-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
4700
+ <path d="M20 6 9 17l-5-5"></path>
4701
+ </svg>
4702
+ </div>
4703
+ </div>
4704
+ `:o.nothing}
4627
4705
  <div class="card-content">
4628
- <!-- Preview images -->
4629
4706
  <div class="preview-container">
4630
4707
  <div class="preview-overlay"></div>
4631
4708
  ${this._renderPreviews()}
4632
4709
  </div>
4633
- <!-- Info section inside the card shape -->
4634
4710
  <div class="info">
4635
4711
  <div class="name" title=${t.name}>${t.name}</div>
4636
4712
  <div class="counts">
@@ -4640,14 +4716,21 @@
4640
4716
  </div>
4641
4717
  </div>
4642
4718
  </div>
4643
- `}};Ue.styles=[J,o.css`
4719
+ `}};pe.styles=[W,o.css`
4644
4720
  :host {
4645
4721
  display: block;
4646
4722
  }
4647
4723
  .card {
4648
4724
  position: relative;
4649
- aspect-ratio: 4/3;
4650
4725
  cursor: pointer;
4726
+ transition: filter 150ms;
4727
+ }
4728
+ :host([selected]) .card {
4729
+ filter:
4730
+ drop-shadow(2px 0 0 var(--ap-primary, oklch(0.578 0.198 268.129)))
4731
+ drop-shadow(-2px 0 0 var(--ap-primary, oklch(0.578 0.198 268.129)))
4732
+ drop-shadow(0 2px 0 var(--ap-primary, oklch(0.578 0.198 268.129)))
4733
+ drop-shadow(0 -2px 0 var(--ap-primary, oklch(0.578 0.198 268.129)));
4651
4734
  }
4652
4735
  /* Folder shape SVG fills card */
4653
4736
  .folder-svg {
@@ -4656,6 +4739,9 @@
4656
4739
  width: 100%;
4657
4740
  height: 100%;
4658
4741
  }
4742
+ .folder-svg path {
4743
+ fill: var(--ap-folder-bg, #E3E8ED);
4744
+ }
4659
4745
  .preview-overlay {
4660
4746
  position: absolute;
4661
4747
  inset: 0;
@@ -4666,24 +4752,30 @@
4666
4752
  transition: opacity 150ms;
4667
4753
  pointer-events: none;
4668
4754
  }
4755
+ .card:hover {
4756
+ filter: drop-shadow(0 4px 12px rgb(0 0 0 / 0.08));
4757
+ }
4758
+ :host([selected]) .card:hover {
4759
+ filter:
4760
+ drop-shadow(2px 0 0 var(--ap-primary, oklch(0.578 0.198 268.129)))
4761
+ drop-shadow(-2px 0 0 var(--ap-primary, oklch(0.578 0.198 268.129)))
4762
+ drop-shadow(0 2px 0 var(--ap-primary, oklch(0.578 0.198 268.129)))
4763
+ drop-shadow(0 -2px 0 var(--ap-primary, oklch(0.578 0.198 268.129)))
4764
+ drop-shadow(0 4px 12px rgb(0 0 0 / 0.08));
4765
+ }
4669
4766
  .card:hover .preview-overlay {
4670
4767
  opacity: 1;
4671
4768
  }
4672
4769
  .card-content {
4673
- position: absolute;
4674
- top: 16%;
4675
- left: 3.5%;
4676
- width: 93%;
4677
- bottom: 0;
4770
+ position: relative;
4678
4771
  z-index: 1;
4772
+ padding: 12% 3.5% 12px;
4679
4773
  display: flex;
4680
4774
  flex-direction: column;
4681
- padding-bottom: 12px;
4682
4775
  }
4683
4776
  .preview-container {
4684
4777
  position: relative;
4685
- flex: 1;
4686
- min-height: 0;
4778
+ aspect-ratio: 16/9;
4687
4779
  display: flex;
4688
4780
  overflow: hidden;
4689
4781
  border-radius: 4px;
@@ -4770,23 +4862,80 @@
4770
4862
  color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
4771
4863
  margin-top: 6px;
4772
4864
  }
4773
- `];It([l.property({type:Object})],Ue.prototype,"folder",2);It([l.property({type:Array})],Ue.prototype,"previews",2);Ue=It([l.customElement("ap-folder-card")],Ue);var Hi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,_s=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ki(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Hi(e,s,a),a};let it=class extends o.LitElement{_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){var e,s;const t=this.folder;return t?o.html`
4774
- <div class="row" @click=${this._handleOpen}>
4775
- <div></div>
4776
- <div class="icon"><ap-icon name="folder" .size=${22}></ap-icon></div>
4865
+ .check {
4866
+ position: absolute;
4867
+ top: 8px;
4868
+ left: 8px;
4869
+ z-index: 3;
4870
+ cursor: pointer;
4871
+ }
4872
+ .check-box {
4873
+ width: 22px;
4874
+ height: 22px;
4875
+ border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
4876
+ border-radius: 4px;
4877
+ display: flex;
4878
+ align-items: center;
4879
+ justify-content: center;
4880
+ transition: all 150ms;
4881
+ background: var(--ap-background, oklch(1 0 0));
4882
+ }
4883
+ .check:hover .check-box {
4884
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
4885
+ }
4886
+ :host([selected]) .check-box {
4887
+ background: var(--ap-primary, oklch(0.578 0.198 268.129));
4888
+ border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
4889
+ }
4890
+ .check-icon {
4891
+ display: none;
4892
+ color: var(--ap-primary-foreground, oklch(1 0 0));
4893
+ }
4894
+ :host([selected]) .check-icon {
4895
+ display: block;
4896
+ }
4897
+ `];Be([c.property({type:Object})],pe.prototype,"folder",2);Be([c.property({type:Array})],pe.prototype,"previews",2);Be([c.property({type:Boolean,reflect:!0})],pe.prototype,"selected",2);Be([c.property({type:Boolean})],pe.prototype,"selectable",2);Be([c.property({type:Number})],pe.prototype,"index",2);pe=Be([c.customElement("ap-folder-card")],pe);var Qa=Object.defineProperty,Za=Object.getOwnPropertyDescriptor,Ce=(t,e,s,i)=>{for(var a=i>1?void 0:i?Za(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Qa(e,s,a),a};let ie=class extends o.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.index=0,this.compactLevel=0}_getGridColumns(){const t=[];return t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("36px"),t.join(" ")}_renderPreviewImg(t){const e=ws(t.file_type),s=ks(t,"80"),i=Ze(bt(t.file_type)),a=Pe();return o.html`<div class="preview-slot ${e?"icon-bg":""}"><img
4898
+ class="preview-img ${e?"icon-mode":""}"
4899
+ src="${s||i}"
4900
+ alt=""
4901
+ loading="lazy"
4902
+ @error=${r=>{const n=r.target,l=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg"))}}
4903
+ /></div>`}_renderThumb(){const t=o.html`
4904
+ <svg class="folder-svg" viewBox="0 0 100 100" preserveAspectRatio="none">
4905
+ <path d="M 3,0 L 30,0 L 43.5,0 Q 45,0 46.5,3 L 51,12 L 97,12 Q 100,12 100,15 L 100,97 Q 100,100 97,100 L 3,100 Q 0,100 0,97 L 0,3 Q 0,0 3,0 Z"
4906
+ />
4907
+ </svg>
4908
+ `,e=this.previews.slice(0,2);return o.html`
4909
+ ${t}
4910
+ <div class="preview-area">
4911
+ ${e.length>0?e.map(s=>this._renderPreviewImg(s)):o.html`<div class="empty-preview">
4912
+ <ap-icon name="inbox" .size=${14}></ap-icon>
4913
+ </div>`}
4914
+ </div>
4915
+ `}_handleClick(t){if(!this.selectable){this._handleOpen();return}if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){t.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:{folder:this.folder,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0,composed:!0}));return}this._handleOpen()}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){var e,s;const t=this.folder;return t?o.html`
4916
+ <div class="row" style="grid-template-columns: ${this._getGridColumns()}" @click=${this._handleClick}>
4917
+ ${this.selectable?o.html`
4918
+ <div class="check">
4919
+ <div class="check-box">
4920
+ <svg class="check-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
4921
+ <path d="M20 6 9 17l-5-5"></path>
4922
+ </svg>
4923
+ </div>
4924
+ </div>
4925
+ `:o.html`<div></div>`}
4926
+ <div class="thumb">${this._renderThumb()}</div>
4777
4927
  <div class="name">${t.name}</div>
4778
4928
  <div class="meta">Folder</div>
4779
- <div class="meta">${((e=t.count)==null?void 0:e.files_recursive)??((s=t.count)==null?void 0:s.files_direct)??0} items</div>
4780
- <div class="meta">${at(t.modified_at||t.updated_at||"")}</div>
4929
+ ${this.compactLevel<2?o.html`<div class="meta">${((e=t.count)==null?void 0:e.files_recursive)??((s=t.count)==null?void 0:s.files_direct)??0} items</div>`:o.nothing}
4930
+ ${this.compactLevel<1?o.html`<div class="meta">${dt(t.modified_at||t.updated_at||"")}</div>`:o.nothing}
4781
4931
  <div></div>
4782
4932
  </div>
4783
- `:o.html``}};it.styles=o.css`
4933
+ `:o.html``}};ie.styles=o.css`
4784
4934
  :host {
4785
4935
  display: block;
4786
4936
  }
4787
4937
  .row {
4788
4938
  display: grid;
4789
- grid-template-columns: 32px 48px 1fr 100px 200px 120px 60px;
4790
4939
  gap: 12px;
4791
4940
  padding: 8px 12px;
4792
4941
  align-items: center;
@@ -4797,31 +4946,159 @@
4797
4946
  .row:hover {
4798
4947
  background: var(--ap-muted, oklch(0.974 0.006 239.819));
4799
4948
  }
4800
- .icon {
4801
- color: var(--ap-input, oklch(0.871 0.016 241.798));
4949
+ :host([selected]) .row {
4950
+ background: var(--ap-selection-bg, oklch(0.578 0.198 268.129 / 0.08));
4951
+ }
4952
+ .thumb {
4953
+ width: 40px;
4954
+ height: 36px;
4955
+ position: relative;
4956
+ flex-shrink: 0;
4957
+ }
4958
+ .folder-svg {
4959
+ position: absolute;
4960
+ inset: 0;
4961
+ width: 100%;
4962
+ height: 100%;
4963
+ }
4964
+ .preview-area {
4965
+ position: absolute;
4966
+ top: 30%;
4967
+ left: 4%;
4968
+ right: 4%;
4969
+ bottom: 8%;
4970
+ overflow: hidden;
4971
+ border-radius: 1.5px;
4972
+ display: flex;
4973
+ gap: 1px;
4974
+ }
4975
+ .preview-slot {
4976
+ flex: 1;
4977
+ min-width: 0;
4978
+ overflow: hidden;
4979
+ background: var(--ap-muted, oklch(0.974 0.006 239.819));
4980
+ }
4981
+ .preview-img {
4982
+ width: 100%;
4983
+ height: 100%;
4984
+ object-fit: cover;
4985
+ display: block;
4986
+ }
4987
+ .preview-img.icon-mode {
4988
+ object-fit: contain;
4989
+ padding: 2px;
4990
+ }
4991
+ .empty-preview {
4802
4992
  display: flex;
4803
4993
  align-items: center;
4804
4994
  justify-content: center;
4995
+ width: 100%;
4996
+ height: 100%;
4997
+ background: var(--ap-muted, oklch(0.974 0.006 239.819));
4998
+ color: var(--ap-input, oklch(0.871 0.016 241.798));
4999
+ }
5000
+ .folder-svg path {
5001
+ fill: var(--ap-folder-bg, #E3E8ED);
5002
+ }
5003
+ .preview-slot.icon-bg {
5004
+ background: var(--ap-card, oklch(1 0 0));
4805
5005
  }
4806
5006
  .name {
4807
5007
  font-size: var(--ap-font-size-sm, 0.875rem);
4808
5008
  font-weight: 400;
4809
5009
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
5010
+ white-space: nowrap;
5011
+ overflow: hidden;
5012
+ text-overflow: ellipsis;
4810
5013
  }
4811
5014
  .meta {
4812
5015
  font-size: 0.8125rem;
4813
5016
  color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
5017
+ white-space: nowrap;
5018
+ overflow: hidden;
5019
+ text-overflow: ellipsis;
5020
+ }
5021
+ .check {
5022
+ display: flex;
5023
+ align-items: center;
5024
+ justify-content: center;
5025
+ cursor: pointer;
5026
+ }
5027
+ .check-box {
5028
+ width: 22px;
5029
+ height: 22px;
5030
+ border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
5031
+ border-radius: 4px;
5032
+ display: flex;
5033
+ align-items: center;
5034
+ justify-content: center;
5035
+ transition: all 150ms;
5036
+ background: var(--ap-background, oklch(1 0 0));
5037
+ }
5038
+ .check:hover .check-box {
5039
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
5040
+ }
5041
+ :host([selected]) .check-box {
5042
+ background: var(--ap-primary, oklch(0.578 0.198 268.129));
5043
+ border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
5044
+ }
5045
+ .check-icon {
5046
+ display: none;
5047
+ color: var(--ap-primary-foreground, oklch(1 0 0));
5048
+ }
5049
+ :host([selected]) .check-icon {
5050
+ display: block;
4814
5051
  }
4815
- `;_s([l.property({type:Object})],it.prototype,"folder",2);it=_s([l.customElement("ap-folder-row")],it);var Gi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,ys=(t,e,s,i)=>{for(var a=i>1?void 0:i?Yi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Gi(e,s,a),a};let rt=class extends o.LitElement{constructor(){super(...arguments),this.variant="grid"}render(){return this.variant==="grid"?o.html`
4816
- <div class="grid-skeleton">
4817
- ${Array.from({length:18},()=>o.html`<div class="skeleton card-skel"></div>`)}
5052
+ `;Ce([c.property({type:Object})],ie.prototype,"folder",2);Ce([c.property({type:Array})],ie.prototype,"previews",2);Ce([c.property({type:Boolean,reflect:!0})],ie.prototype,"selected",2);Ce([c.property({type:Boolean})],ie.prototype,"selectable",2);Ce([c.property({type:Number})],ie.prototype,"index",2);Ce([c.property({type:Number})],ie.prototype,"compactLevel",2);ie=Ce([c.customElement("ap-folder-row")],ie);var Ja=Object.defineProperty,er=Object.getOwnPropertyDescriptor,et=(t,e,s,i)=>{for(var a=i>1?void 0:i?er(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ja(e,s,a),a};let we=class extends o.LitElement{constructor(){super(...arguments),this.variant="grid",this.gridSize="normal",this.multiSelect=!0,this.folderCount=0}render(){if(this.variant==="grid"){const n=this.gridSize==="large"?"280px":"220px";return o.html`
5053
+ <div class="grid-skeleton" style="--ap-grid-min-col: ${n}">
5054
+ ${Array.from({length:18},()=>o.html`<div class="card-skel">
5055
+ <div class="skeleton card-skel-thumb"></div>
5056
+ <div class="card-skel-info">
5057
+ <div class="skeleton card-skel-name"></div>
5058
+ <div class="skeleton card-skel-meta"></div>
5059
+ </div>
5060
+ </div>`)}
4818
5061
  </div>
4819
- `:o.html`
4820
- ${Array.from({length:7},()=>o.html`<div class="skeleton row-skel"></div>`)}
4821
- `}};rt.styles=o.css`
5062
+ `}const t=[];this.multiSelect&&t.push("32px"),t.push("48px","minmax(120px, 1fr)","72px","100px","120px","36px");const e=t.join(" "),s=o.html`
5063
+ <div class="row-skel" style="grid-template-columns: ${e}">
5064
+ ${this.multiSelect?o.html`<div class="row-skel-check-wrap"><div class="skeleton row-skel-check"></div></div>`:""}
5065
+ <div class="row-skel-folder-thumb">
5066
+ <svg viewBox="0 0 100 100" preserveAspectRatio="none">
5067
+ <path d="M 3,0 L 30,0 L 43.5,0 Q 45,0 46.5,3 L 51,12 L 97,12 Q 100,12 100,15 L 100,97 Q 100,100 97,100 L 3,100 Q 0,100 0,97 L 0,3 Q 0,0 3,0 Z" />
5068
+ </svg>
5069
+ </div>
5070
+ <div class="skeleton row-skel-name" style="width: 55%"></div>
5071
+ <div class="skeleton row-skel-type"></div>
5072
+ <div class="skeleton row-skel-size"></div>
5073
+ <div class="skeleton row-skel-date"></div>
5074
+ <div></div>
5075
+ </div>
5076
+ `,i=n=>o.html`
5077
+ <div class="row-skel" style="grid-template-columns: ${e}">
5078
+ ${this.multiSelect?o.html`<div class="row-skel-check-wrap"><div class="skeleton row-skel-check"></div></div>`:""}
5079
+ <div class="skeleton row-skel-thumb"></div>
5080
+ <div class="skeleton row-skel-name" style="width: ${n}"></div>
5081
+ <div class="skeleton row-skel-type"></div>
5082
+ <div class="skeleton row-skel-size"></div>
5083
+ <div class="skeleton row-skel-date"></div>
5084
+ <div></div>
5085
+ </div>
5086
+ `,a=["70%","55%","80%","45%","65%","50%","75%","60%","85%","40%","72%","58%"],r=12-this.folderCount;return o.html`
5087
+ <div class="list-header" style="grid-template-columns: ${e}">
5088
+ ${this.multiSelect?o.html`<div class="header-check-wrap"><div class="header-check-box"></div></div>`:""}
5089
+ <span></span>
5090
+ <span>Name</span>
5091
+ <span>Type</span>
5092
+ <span>Size</span>
5093
+ <span>Date</span>
5094
+ <span></span>
5095
+ </div>
5096
+ ${Array.from({length:this.folderCount},()=>s)}
5097
+ ${Array.from({length:r},(n,l)=>i(a[l%a.length]))}
5098
+ `}};we.styles=o.css`
4822
5099
  :host {
4823
5100
  display: block;
4824
- padding: 16px 20px;
5101
+ padding: 0 20px 16px;
4825
5102
  }
4826
5103
  .skeleton {
4827
5104
  background: linear-gradient(90deg, var(--ap-muted, oklch(0.974 0.006 239.819)) 25%, #e8e8ea 50%, var(--ap-muted, oklch(0.974 0.006 239.819)) 75%);
@@ -4835,22 +5112,115 @@
4835
5112
  }
4836
5113
  .grid-skeleton {
4837
5114
  display: grid;
4838
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
5115
+ grid-template-columns: repeat(auto-fill, minmax(var(--ap-grid-min-col, 220px), 1fr));
4839
5116
  gap: 24px;
4840
5117
  }
4841
5118
  .card-skel {
4842
- aspect-ratio: 6/4;
4843
5119
  border-radius: var(--ap-radius, 8px);
5120
+ overflow: hidden;
5121
+ }
5122
+ .card-skel-thumb {
5123
+ aspect-ratio: 6/4;
5124
+ }
5125
+ .card-skel-info {
5126
+ padding: 10px 12px;
5127
+ }
5128
+ .card-skel-name {
5129
+ height: 14px;
5130
+ width: 70%;
5131
+ border-radius: 4px;
5132
+ }
5133
+ .card-skel-meta {
5134
+ height: 12px;
5135
+ width: 50%;
5136
+ border-radius: 4px;
5137
+ margin-top: 6px;
4844
5138
  }
4845
5139
  .row-skel {
4846
- height: 56px;
4847
- margin-bottom: 1px;
5140
+ display: grid;
5141
+ gap: 12px;
5142
+ padding: 8px 12px;
5143
+ align-items: center;
5144
+ border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
5145
+ }
5146
+ .row-skel-check-wrap {
5147
+ display: flex;
5148
+ align-items: center;
5149
+ justify-content: center;
5150
+ }
5151
+ .row-skel-check {
5152
+ width: 22px;
5153
+ height: 22px;
4848
5154
  border-radius: 4px;
4849
5155
  }
5156
+ .row-skel-thumb {
5157
+ width: 40px;
5158
+ height: 40px;
5159
+ border-radius: 4px;
5160
+ }
5161
+ .row-skel-name {
5162
+ height: 14px;
5163
+ width: 70%;
5164
+ border-radius: 4px;
5165
+ }
5166
+ .row-skel-type {
5167
+ height: 12px;
5168
+ width: 40px;
5169
+ border-radius: 4px;
5170
+ }
5171
+ .row-skel-size {
5172
+ height: 12px;
5173
+ width: 48px;
5174
+ border-radius: 4px;
5175
+ }
5176
+ .row-skel-date {
5177
+ height: 12px;
5178
+ width: 72px;
5179
+ border-radius: 4px;
5180
+ }
5181
+ .row-skel-folder-thumb {
5182
+ width: 40px;
5183
+ height: 36px;
5184
+ position: relative;
5185
+ }
5186
+ .row-skel-folder-thumb svg {
5187
+ width: 100%;
5188
+ height: 100%;
5189
+ }
5190
+ .row-skel-folder-thumb svg path {
5191
+ fill: var(--ap-muted, oklch(0.974 0.006 239.819));
5192
+ }
5193
+ .list-header {
5194
+ display: grid;
5195
+ gap: 12px;
5196
+ padding: 8px 12px;
5197
+ font-size: 14px;
5198
+ font-weight: 400;
5199
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
5200
+ border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
5201
+ }
5202
+ .list-header span {
5203
+ white-space: nowrap;
5204
+ overflow: hidden;
5205
+ text-overflow: ellipsis;
5206
+ }
5207
+ .header-check-wrap {
5208
+ display: flex;
5209
+ align-items: center;
5210
+ justify-content: center;
5211
+ }
5212
+ .header-check-box {
5213
+ box-sizing: border-box;
5214
+ width: 22px;
5215
+ height: 22px;
5216
+ border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
5217
+ border-radius: 4px;
5218
+ background: var(--ap-background, oklch(1 0 0));
5219
+ }
4850
5220
  @media (prefers-reduced-motion: reduce) {
4851
5221
  .skeleton { animation: none; }
4852
5222
  }
4853
- `;ys([l.property()],rt.prototype,"variant",2);rt=ys([l.customElement("ap-skeleton")],rt);function Xi(t){var a,r;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(r=e[0])==null?void 0:r.playlists;return s!=null&&s.length&&s[0]||null}var Wi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,O=(t,e,s,i)=>{for(var a=i>1?void 0:i?Qi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Wi(e,s,a),a};let M=class extends o.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=Se(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Xi(t);if(!e||(await this.updateComplete,((i=this.asset)==null?void 0:i.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:r}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!r.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new r;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(r.Events.ERROR,(c,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,i,a,r,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((a=(i=this.asset)==null?void 0:i.url)!=null&&a.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(r=this.previewArea)==null?void 0:r.requestFullscreen)==null||n.call(r)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=Se(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let i=t+e;i!==s;i+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[i]))return i;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var i,a;const e=(i=t.url)==null?void 0:i.cdn;if(!e)return st(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=Fe(e,this.containerToken);return ze(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,c;const e=(n=t.info)==null?void 0:n.img_w,s=(c=t.info)==null?void 0:c.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,r=Math.min(i/e,a/s,1);return{width:`${Math.round(e*r)}px`,height:`${Math.round(s*r)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),i=new Set;return s.filter(a=>!a.label||i.has(a.sid)?!1:(i.add(a.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.TAGS,values:[t],operator:y.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.LABELS,values:[t],operator:y.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return o.nothing;const s=this._openSections.has("file-info");return o.html`
5223
+ `;et([c.property({reflect:!0})],we.prototype,"variant",2);et([c.property({type:String})],we.prototype,"gridSize",2);et([c.property({type:Boolean})],we.prototype,"multiSelect",2);et([c.property({type:Number})],we.prototype,"folderCount",2);we=et([c.customElement("ap-skeleton")],we);function tr(t){var a,r;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(r=e[0])==null?void 0:r.playlists;return s!=null&&s.length&&s[0]||null}var sr=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,I=(t,e,s,i)=>{for(var a=i>1?void 0:i?ir(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&sr(e,s,a),a};let O=class extends o.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=Me(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=tr(t);if(!e||(await this.updateComplete,((i=this.asset)==null?void 0:i.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:r}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!r.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new r;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(r.Events.ERROR,(l,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,i,a,r,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((a=(i=this.asset)==null?void 0:i.url)!=null&&a.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(r=this.previewArea)==null?void 0:r.requestFullscreen)==null||n.call(r)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=Me(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let i=t+e;i!==s;i+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[i]))return i;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var i,a;const e=(i=t.url)==null?void 0:i.cdn;if(!e)return ct(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=Ie(e,this.containerToken);return Ke(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,l;const e=(n=t.info)==null?void 0:n.img_w,s=(l=t.info)==null?void 0:l.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,r=Math.min(i/e,a/s,1);return{width:`${Math.round(e*r)}px`,height:`${Math.round(s*r)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),i=new Set;return s.filter(a=>!a.label||i.has(a.sid)?!1:(i.add(a.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:v.TAGS,values:[t],operator:w.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:v.LABELS,values:[t],operator:w.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return o.nothing;const s=this._openSections.has("file-info");return o.html`
4854
5224
  <div class="accordion">
4855
5225
  <button
4856
5226
  class="accordion-trigger"
@@ -4894,7 +5264,7 @@
4894
5264
  `)}
4895
5265
  </div>
4896
5266
  </div>
4897
- `}_getFileInfoRows(t){var s,i,a,r,n,c;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:Lt(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:ms(t.info.img_w,t.info.img_h)}),(a=t.info)!=null&&a.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(((r=t.info)==null?void 0:r.video_duration)??((n=t.info)==null?void 0:n.duration))!=null&&e.push({label:"Duration",value:`${Math.round(t.info.video_duration??t.info.duration)}s`}),(c=t.info)!=null&&c.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:at(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:at(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var i;if(!((i=e.possible_values)!=null&&i.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(a=>a.internal_unique_value===t||a.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const i=this.regionalFilters[e.regionalVariantsGroupUuid];if(i){const a=t[i];if(a!=null&&a!=="")return this._resolveFieldValue(a,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(a=>this._resolveSlug(String(a),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const i=JSON.stringify(t);return i==="{}"||i==="[]"?"":i}return String(t)}_getAllMetadataRows(t){var r,n,c,d;const e=[],s=this._buildFieldMap(),i=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const f=h[u.key]??((n=(r=t.info)==null?void 0:r.metadata)==null?void 0:n[u.key])??((c=t.meta)==null?void 0:c[u.key]),p=this._resolveFieldValue(f,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const g=p.length>50;e.push({label:u.label,value:p,wrap:g})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}const a=(d=t.info)==null?void 0:d.metadata;if(a&&typeof a=="object")for(const[h,u]of Object.entries(a)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}return e}_getAssetLabels(t){return!t.labels||t.labels.length===0?[]:t.labels.map(e=>this.labels.find(s=>s.sid===e||s.uuid===e)).filter(e=>!!e)}_renderLabelsRow(t){const e=this._getAssetLabels(t);return e.length===0?o.nothing:o.html`
5267
+ `}_getFileInfoRows(t){var s,i,a,r,n,l;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:jt(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:Ss(t.info.img_w,t.info.img_h)}),(a=t.info)!=null&&a.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(((r=t.info)==null?void 0:r.video_duration)??((n=t.info)==null?void 0:n.duration))!=null&&e.push({label:"Duration",value:`${Math.round(t.info.video_duration??t.info.duration)}s`}),(l=t.info)!=null&&l.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:dt(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:dt(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var i;if(!((i=e.possible_values)!=null&&i.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(a=>a.internal_unique_value===t||a.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const i=this.regionalFilters[e.regionalVariantsGroupUuid];if(i){const a=t[i];if(a!=null&&a!=="")return this._resolveFieldValue(a,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(a=>this._resolveSlug(String(a),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const i=JSON.stringify(t);return i==="{}"||i==="[]"?"":i}return String(t)}_getAllMetadataRows(t){var r,n,l,d;const e=[],s=this._buildFieldMap(),i=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const f=h[u.key]??((n=(r=t.info)==null?void 0:r.metadata)==null?void 0:n[u.key])??((l=t.meta)==null?void 0:l[u.key]),p=this._resolveFieldValue(f,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const g=p.length>50;e.push({label:u.label,value:p,wrap:g})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:g,value:p,wrap:m})}}const a=(d=t.info)==null?void 0:d.metadata;if(a&&typeof a=="object")for(const[h,u]of Object.entries(a)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:g,value:p,wrap:m})}}return e}_getAssetLabels(t){return!t.labels||t.labels.length===0?[]:t.labels.map(e=>this.labels.find(s=>s.sid===e||s.uuid===e)).filter(e=>!!e)}_renderLabelsRow(t){const e=this._getAssetLabels(t);return e.length===0?o.nothing:o.html`
4898
5268
  <div class="meta-row" style="flex-direction:column;gap:6px">
4899
5269
  <span class="meta-label">Labels</span>
4900
5270
  <div class="tags-list">
@@ -4917,7 +5287,7 @@
4917
5287
  `)}
4918
5288
  </div>
4919
5289
  </div>
4920
- `}render(){var j,S,L,D,se,ce,we,Ge;const t=this.asset;if(!t)return o.nothing;const e=Se(t.type),s=e==="image",i=e==="video",a=e==="audio",r=((j=t.extension)==null?void 0:j.toLowerCase())==="pdf",n=ut(t.extension||""),c=Pt(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=st(t),u=s?d?((L=t.url)==null?void 0:L.cdn)||"":h||Fe(((D=t.url)==null?void 0:D.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=i&&((se=t.url)==null?void 0:se.cdn)||"",v=i&&(((ce=t.info)==null?void 0:ce.video_thumbnail)||((we=t.info)==null?void 0:we.preview))||"",x=r&&!s?Ot(t):"",b=this._getCurrentIndex(),k=b>0&&this._findNavTarget(b,-1)>=0,$=b>=0&&this._findNavTarget(b,1)>=0,F=this.assets.length>1;return o.html`
5290
+ `}render(){var T,$,L,P,X,ue,Fe,tt;const t=this.asset;if(!t)return o.nothing;const e=Me(t.type),s=e==="image",i=e==="video",a=e==="audio",r=((T=t.extension)==null?void 0:T.toLowerCase())==="pdf",n=Ze(t.extension||""),l=Rt(t.extension||""),d=(($=t.extension)==null?void 0:$.toLowerCase())==="svg",h=ct(t),u=s?d?((L=t.url)==null?void 0:L.cdn)||"":h||Ie(((P=t.url)==null?void 0:P.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=i&&((X=t.url)==null?void 0:X.cdn)||"",m=i&&(((ue=t.info)==null?void 0:ue.video_thumbnail)||((Fe=t.info)==null?void 0:Fe.preview))||"",y=r&&!s?Nt(t):"",x=this._getCurrentIndex(),S=x>0&&this._findNavTarget(x,-1)>=0,b=x>=0&&this._findNavTarget(x,1)>=0,C=this.assets.length>1;return o.html`
4921
5291
  <div class="panel">
4922
5292
  <div class="panel-header">
4923
5293
  <span class="panel-title" title=${t.name}>${t.name}</span>
@@ -4935,12 +5305,12 @@
4935
5305
  </div>
4936
5306
  </div>
4937
5307
 
4938
- <div class="preview-area ${s&&c?"chess":""}">
4939
- ${F?o.html`
4940
- <button class="nav-btn prev" @click=${this._prev} ?disabled=${!k} aria-label="Previous">
5308
+ <div class="preview-area ${s&&l?"chess":""}">
5309
+ ${C?o.html`
5310
+ <button class="nav-btn prev" @click=${this._prev} ?disabled=${!S} aria-label="Previous">
4941
5311
  <ap-icon name="chevron-left" .size=${16}></ap-icon>
4942
5312
  </button>
4943
- <button class="nav-btn next" @click=${this._next} ?disabled=${!$} aria-label="Next">
5313
+ <button class="nav-btn next" @click=${this._next} ?disabled=${!b} aria-label="Next">
4944
5314
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
4945
5315
  </button>
4946
5316
  `:o.nothing}
@@ -4954,8 +5324,8 @@
4954
5324
  <img
4955
5325
  src=${u}
4956
5326
  alt=${t.name}
4957
- @load=${de=>{de.target.classList.remove("icon-fallback"),this._previewLoading=!1}}
4958
- @error=${de=>{const pe=de.target;this._previewLoading=!1,pe.src!==n&&(pe.src=n,pe.classList.add("icon-fallback"))}}
5327
+ @load=${ge=>{ge.target.classList.remove("icon-fallback"),this._previewLoading=!1}}
5328
+ @error=${ge=>{const fe=ge.target;this._previewLoading=!1,fe.src!==n&&(fe.src=n,fe.classList.add("icon-fallback"))}}
4959
5329
  />
4960
5330
  <div class="fs-wrapper">
4961
5331
  ${d?o.nothing:o.html`
@@ -4975,14 +5345,14 @@
4975
5345
  />
4976
5346
  </div>
4977
5347
  `:o.nothing}
4978
- ${i?o.html`<video src=${g} poster=${v||o.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
4979
- ${a?o.html`<audio src=${((Ge=t.url)==null?void 0:Ge.cdn)||""} controls></audio>`:o.nothing}
5348
+ ${i?o.html`<video src=${g} poster=${m||o.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
5349
+ ${a?o.html`<audio src=${((tt=t.url)==null?void 0:tt.cdn)||""} controls></audio>`:o.nothing}
4980
5350
  ${r&&!s?o.html`
4981
5351
  <img
4982
- src=${x||n}
5352
+ src=${y||n}
4983
5353
  alt=${t.name}
4984
- class=${x?"":"icon-fallback"}
4985
- @error=${de=>{const pe=de.target;pe.src!==n&&(pe.src=n,pe.classList.add("icon-fallback"))}}
5354
+ class=${y?"":"icon-fallback"}
5355
+ @error=${ge=>{const fe=ge.target;fe.src!==n&&(fe.src=n,fe.classList.add("icon-fallback"))}}
4986
5356
  />
4987
5357
  `:o.nothing}
4988
5358
  ${!s&&!i&&!a&&!r?o.html`<img src=${n} alt=${t.name} class="icon-fallback" />`:o.nothing}
@@ -4993,7 +5363,7 @@
4993
5363
  ${this._renderAccordion("metadata","Metadata",this._getAllMetadataRows(t))}
4994
5364
  `:o.nothing}
4995
5365
  </div>
4996
- `}};M.styles=o.css`
5366
+ `}};O.styles=o.css`
4997
5367
  :host {
4998
5368
  display: block;
4999
5369
  }
@@ -5304,7 +5674,7 @@
5304
5674
  .panel { animation: none; }
5305
5675
  .accordion-chevron { transition: none; }
5306
5676
  }
5307
- `;O([l.property({type:Object})],M.prototype,"asset",2);O([l.property({type:Array})],M.prototype,"assets",2);O([l.property({type:Array})],M.prototype,"selectedIds",2);O([l.property()],M.prototype,"containerToken",2);O([l.property({type:Boolean})],M.prototype,"showMetadata",2);O([l.property({type:Array})],M.prototype,"metadataFields",2);O([l.property({type:Array})],M.prototype,"labels",2);O([l.property({type:Object})],M.prototype,"regionalFilters",2);O([l.property({type:Boolean})],M.prototype,"multiSelect",2);O([l.query(".preview-area")],M.prototype,"previewArea",2);O([l.query("video")],M.prototype,"_videoEl",2);O([l.state()],M.prototype,"_isFullscreen",2);O([l.state()],M.prototype,"_fsImageLoaded",2);O([l.state()],M.prototype,"_previewLoading",2);O([l.state()],M.prototype,"_openSections",2);M=O([l.customElement("ap-preview-panel")],M);var Zi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,Dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zi(e,s,a),a};const er={search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5","check-check":[{tag:"path",attrs:{d:"M18 6 7 17l-5-5"}},{tag:"path",attrs:{d:"m22 10-7.5 7.5L13 16"}}],close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",inbox:[{tag:"path",attrs:{d:"M22 12L16 12L14 15L10 15L8 12L2 12"}},{tag:"path",attrs:{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}}],tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],"toggle-left":[{tag:"rect",attrs:{width:"20",height:"14",x:"2",y:"5",rx:"7"}},{tag:"circle",attrs:{cx:"9",cy:"12",r:"3"}}],"file-digit":[{tag:"path",attrs:{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 16h2v6"}},{tag:"path",attrs:{d:"M10 22h4"}},{tag:"rect",attrs:{width:"4",height:"6",x:"2",y:"16",rx:"2"}}],"decimals-arrow-right":[{tag:"path",attrs:{d:"M10 18h10"}},{tag:"path",attrs:{d:"m17 21 3-3-3-3"}},{tag:"path",attrs:{d:"M3 11h.01"}},{tag:"rect",attrs:{width:"5",height:"8",x:"15",y:"3",rx:"2.5"}},{tag:"rect",attrs:{width:"5",height:"8",x:"6",y:"3",rx:"2.5"}}],"text-initial":[{tag:"path",attrs:{d:"M15 5h6"}},{tag:"path",attrs:{d:"M15 12h6"}},{tag:"path",attrs:{d:"M3 19h18"}},{tag:"path",attrs:{d:"m3 12 3.553-7.724a.5.5 0 0 1 .894 0L11 12"}},{tag:"path",attrs:{d:"M3.92 10h6.16"}}],"text-align-justify":[{tag:"path",attrs:{d:"M3 5h18"}},{tag:"path",attrs:{d:"M3 12h18"}},{tag:"path",attrs:{d:"M3 19h18"}}],paperclip:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551","link-2":[{tag:"path",attrs:{d:"M9 17H7A5 5 0 0 1 7 7h2"}},{tag:"path",attrs:{d:"M15 7h2a5 5 0 1 1 0 10h-2"}},{tag:"path",attrs:{d:"M8 12h8"}}],"circle-dot":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}}],"square-check":[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],locate:[{tag:"path",attrs:{d:"M2 12h3"}},{tag:"path",attrs:{d:"M19 12h3"}},{tag:"path",attrs:{d:"M12 2v3"}},{tag:"path",attrs:{d:"M12 19v3"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"7"}}],"list-ordered":[{tag:"path",attrs:{d:"M11 5h10"}},{tag:"path",attrs:{d:"M11 12h10"}},{tag:"path",attrs:{d:"M11 19h10"}},{tag:"path",attrs:{d:"M4 4h1v5"}},{tag:"path",attrs:{d:"M4 9h2"}},{tag:"path",attrs:{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}}],plus:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let Be=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=er[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?o.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?o.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:o.svg`<path d=${a.d}></path>`});return o.html`
5677
+ `;I([c.property({type:Object})],O.prototype,"asset",2);I([c.property({type:Array})],O.prototype,"assets",2);I([c.property({type:Array})],O.prototype,"selectedIds",2);I([c.property()],O.prototype,"containerToken",2);I([c.property({type:Boolean})],O.prototype,"showMetadata",2);I([c.property({type:Array})],O.prototype,"metadataFields",2);I([c.property({type:Array})],O.prototype,"labels",2);I([c.property({type:Object})],O.prototype,"regionalFilters",2);I([c.property({type:Boolean})],O.prototype,"multiSelect",2);I([c.query(".preview-area")],O.prototype,"previewArea",2);I([c.query("video")],O.prototype,"_videoEl",2);I([c.state()],O.prototype,"_isFullscreen",2);I([c.state()],O.prototype,"_fsImageLoaded",2);I([c.state()],O.prototype,"_previewLoading",2);I([c.state()],O.prototype,"_openSections",2);O=I([c.customElement("ap-preview-panel")],O);var ar=Object.defineProperty,rr=Object.getOwnPropertyDescriptor,Bt=(t,e,s,i)=>{for(var a=i>1?void 0:i?rr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ar(e,s,a),a};const or={search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5","check-check":[{tag:"path",attrs:{d:"M18 6 7 17l-5-5"}},{tag:"path",attrs:{d:"m22 10-7.5 7.5L13 16"}}],close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",inbox:[{tag:"path",attrs:{d:"M22 12L16 12L14 15L10 15L8 12L2 12"}},{tag:"path",attrs:{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}}],tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],"toggle-left":[{tag:"rect",attrs:{width:"20",height:"14",x:"2",y:"5",rx:"7"}},{tag:"circle",attrs:{cx:"9",cy:"12",r:"3"}}],"file-digit":[{tag:"path",attrs:{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 16h2v6"}},{tag:"path",attrs:{d:"M10 22h4"}},{tag:"rect",attrs:{width:"4",height:"6",x:"2",y:"16",rx:"2"}}],"decimals-arrow-right":[{tag:"path",attrs:{d:"M10 18h10"}},{tag:"path",attrs:{d:"m17 21 3-3-3-3"}},{tag:"path",attrs:{d:"M3 11h.01"}},{tag:"rect",attrs:{width:"5",height:"8",x:"15",y:"3",rx:"2.5"}},{tag:"rect",attrs:{width:"5",height:"8",x:"6",y:"3",rx:"2.5"}}],"text-initial":[{tag:"path",attrs:{d:"M15 5h6"}},{tag:"path",attrs:{d:"M15 12h6"}},{tag:"path",attrs:{d:"M3 19h18"}},{tag:"path",attrs:{d:"m3 12 3.553-7.724a.5.5 0 0 1 .894 0L11 12"}},{tag:"path",attrs:{d:"M3.92 10h6.16"}}],"text-align-justify":[{tag:"path",attrs:{d:"M3 5h18"}},{tag:"path",attrs:{d:"M3 12h18"}},{tag:"path",attrs:{d:"M3 19h18"}}],paperclip:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551","link-2":[{tag:"path",attrs:{d:"M9 17H7A5 5 0 0 1 7 7h2"}},{tag:"path",attrs:{d:"M15 7h2a5 5 0 1 1 0 10h-2"}},{tag:"path",attrs:{d:"M8 12h8"}}],"circle-dot":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}}],"square-check":[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],locate:[{tag:"path",attrs:{d:"M2 12h3"}},{tag:"path",attrs:{d:"M19 12h3"}},{tag:"path",attrs:{d:"M12 2v3"}},{tag:"path",attrs:{d:"M12 19v3"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"7"}}],"list-ordered":[{tag:"path",attrs:{d:"M11 5h10"}},{tag:"path",attrs:{d:"M11 12h10"}},{tag:"path",attrs:{d:"M11 19h10"}},{tag:"path",attrs:{d:"M4 4h1v5"}},{tag:"path",attrs:{d:"M4 9h2"}},{tag:"path",attrs:{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}}],plus:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let Xe=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=or[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?o.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?o.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:o.svg`<path d=${a.d}></path>`});return o.html`
5308
5678
  <svg
5309
5679
  style="--icon-size: ${this.size}px"
5310
5680
  viewBox="0 0 24 24"
@@ -5316,7 +5686,7 @@
5316
5686
  >
5317
5687
  ${e}
5318
5688
  </svg>
5319
- `}};Be.styles=[o.css`
5689
+ `}};Xe.styles=[o.css`
5320
5690
  :host {
5321
5691
  display: inline-flex;
5322
5692
  align-items: center;
@@ -5326,22 +5696,22 @@
5326
5696
  width: var(--icon-size, 20px);
5327
5697
  height: var(--icon-size, 20px);
5328
5698
  }
5329
- `];Dt([l.property()],Be.prototype,"name",2);Dt([l.property({type:Number})],Be.prototype,"size",2);Be=Dt([l.customElement("ap-icon")],Be);var tr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,Le=(t,e,s,i)=>{for(var a=i>1?void 0:i?sr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&tr(e,s,a),a};let oe=class extends o.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.totalCount=0,this.isSelectingAll=!1,this.multiSelect=!0}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0}))}render(){return this.selectedAssets.length===0?o.nothing:o.html`
5699
+ `];Bt([c.property()],Xe.prototype,"name",2);Bt([c.property({type:Number})],Xe.prototype,"size",2);Xe=Bt([c.customElement("ap-icon")],Xe);var nr=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,Ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?lr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&nr(e,s,a),a};let ae=class extends o.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.selectedFolders=[],this.totalCount=0,this.isSelectingAll=!1,this.multiSelect=!0}get _totalSelected(){return this.selectedAssets.length+this.selectedFolders.length}_formatCount(){const t=this.selectedAssets.length,e=this.selectedFolders.length;if(e===0)return`${t} selected`;if(t===0)return`${e} folder${e!==1?"s":""} selected`;const s=`${e} folder${e!==1?"s":""}`,i=`${t} asset${t!==1?"s":""}`;return`${s} and ${i} selected`}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0}))}render(){return this._totalSelected===0?o.nothing:o.html`
5330
5700
  <div class="bar">
5331
- <span class="count">${this.selectedAssets.length} selected</span>
5701
+ <span class="count">${this._formatCount()}</span>
5332
5702
  <span class="divider"></span>
5333
5703
  <span class="select-label">Select:</span>
5334
- ${this.multiSelect&&this.selectedAssets.length<this.totalCount&&(!this.maxSelections||this.selectedAssets.length<this.maxSelections)?o.html`<button
5704
+ ${this.multiSelect&&this._totalSelected<this.totalCount&&(!this.maxSelections||this._totalSelected<this.maxSelections)?o.html`<button
5335
5705
  class="bar-btn"
5336
5706
  ?disabled=${this.isSelectingAll}
5337
5707
  @click=${this._selectAll}
5338
5708
  ><ap-icon name="check-check" .size=${14}></ap-icon>${this.isSelectingAll?"Selecting...":this.maxSelections&&this.maxSelections<this.totalCount?`First ${this.maxSelections}`:"Select all"}</button>`:o.nothing}
5339
5709
  <button class="bar-btn" @click=${this._clear}><ap-icon name="close" .size=${14}></ap-icon>Deselect all</button>
5340
- ${this.maxSelections&&this.selectedAssets.length>=this.maxSelections?o.html`<span class="limit-notice">Max ${this.maxSelections} allowed</span>`:o.nothing}
5710
+ ${this.maxSelections&&this._totalSelected>=this.maxSelections?o.html`<span class="limit-notice">Max ${this.maxSelections} allowed</span>`:o.nothing}
5341
5711
  <div class="spacer"></div>
5342
5712
  <button class="btn-confirm" @click=${this._confirm}>Confirm</button>
5343
5713
  </div>
5344
- `}};oe.styles=o.css`
5714
+ `}};ae.styles=o.css`
5345
5715
  :host {
5346
5716
  display: block;
5347
5717
  padding: 0 8px 8px;
@@ -5428,12 +5798,12 @@
5428
5798
  @media (prefers-reduced-motion: reduce) {
5429
5799
  .bar { animation: none; }
5430
5800
  }
5431
- `;Le([l.property({type:Array})],oe.prototype,"selectedAssets",2);Le([l.property({type:Number})],oe.prototype,"totalCount",2);Le([l.property({type:Boolean})],oe.prototype,"isSelectingAll",2);Le([l.property({type:Boolean})],oe.prototype,"multiSelect",2);Le([l.property({type:Number})],oe.prototype,"maxSelections",2);oe=Le([l.customElement("ap-selection-bar")],oe);var ar=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,zt=(t,e,s,i)=>{for(var a=i>1?void 0:i?ir(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ar(e,s,a),a};let Ve=class extends o.LitElement{constructor(){super(...arguments),this.active=!1,this.rect={x:0,y:0,width:0,height:0}}render(){return!this.active||this.rect.width<5||this.rect.height<5?o.nothing:o.html`
5801
+ `;Ee([c.property({type:Array})],ae.prototype,"selectedAssets",2);Ee([c.property({type:Array})],ae.prototype,"selectedFolders",2);Ee([c.property({type:Number})],ae.prototype,"totalCount",2);Ee([c.property({type:Boolean})],ae.prototype,"isSelectingAll",2);Ee([c.property({type:Boolean})],ae.prototype,"multiSelect",2);Ee([c.property({type:Number})],ae.prototype,"maxSelections",2);ae=Ee([c.customElement("ap-selection-bar")],ae);var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,Ut=(t,e,s,i)=>{for(var a=i>1?void 0:i?dr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&cr(e,s,a),a};let We=class extends o.LitElement{constructor(){super(...arguments),this.active=!1,this.rect={x:0,y:0,width:0,height:0}}render(){return!this.active||this.rect.width<5||this.rect.height<5?o.nothing:o.html`
5432
5802
  <div
5433
5803
  class="marquee"
5434
5804
  style="left:${this.rect.x}px;top:${this.rect.y}px;width:${this.rect.width}px;height:${this.rect.height}px"
5435
5805
  ></div>
5436
- `}};Ve.styles=o.css`
5806
+ `}};We.styles=o.css`
5437
5807
  :host {
5438
5808
  display: block;
5439
5809
  position: absolute;
@@ -5450,7 +5820,82 @@
5450
5820
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
5451
5821
  border-radius: 2px;
5452
5822
  }
5453
- `;zt([l.property({type:Boolean})],Ve.prototype,"active",2);zt([l.property({type:Object})],Ve.prototype,"rect",2);Ve=zt([l.customElement("ap-marquee-overlay")],Ve);var rr=Object.defineProperty,or=Object.getOwnPropertyDescriptor,xs=(t,e,s,i)=>{for(var a=i>1?void 0:i?or(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&rr(e,s,a),a};let ot=class extends o.LitElement{constructor(){super(...arguments),this.size=24}render(){return o.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};ot.styles=[o.css`
5823
+ `;Ut([c.property({type:Boolean})],We.prototype,"active",2);Ut([c.property({type:Object})],We.prototype,"rect",2);We=Ut([c.customElement("ap-marquee-overlay")],We);var pr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,Ue=(t,e,s,i)=>{for(var a=i>1?void 0:i?hr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&pr(e,s,a),a};let he=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(a=>!this.disabled&&!a.disabled);if(e.length===0)return;const s=e.findIndex(a=>a.value===this.value);let i=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),i=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),i=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}i!==null&&this._select(e[i])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return o.html`
5824
+ ${this.options.map(t=>o.html`
5825
+ <div
5826
+ class="option"
5827
+ role="radio"
5828
+ aria-checked=${t.value===this.value}
5829
+ aria-disabled=${this.disabled||t.disabled?"true":o.nothing}
5830
+ @click=${()=>this._select(t)}
5831
+ >
5832
+ <div class="radio"><div class="dot"></div></div>
5833
+ ${t.icon?o.html`<ap-icon name=${t.icon} .size=${16}></ap-icon>`:o.nothing}
5834
+ <span class="label">${t.label}</span>
5835
+ </div>
5836
+ `)}
5837
+ `}_select(t){this.disabled||t.disabled||this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t.value},bubbles:!0,composed:!0}))}};he.styles=[W,o.css`
5838
+ :host {
5839
+ display: flex;
5840
+ flex-direction: column;
5841
+ gap: 6px;
5842
+ }
5843
+ :host([direction="horizontal"]) {
5844
+ flex-direction: row;
5845
+ gap: 16px;
5846
+ }
5847
+ :host([columns="2"]) {
5848
+ display: grid;
5849
+ grid-template-columns: 1fr 1fr;
5850
+ gap: 8px;
5851
+ }
5852
+ .option {
5853
+ display: flex;
5854
+ align-items: center;
5855
+ gap: 8px;
5856
+ cursor: pointer;
5857
+ padding: 2px 0;
5858
+ }
5859
+ .option[aria-disabled="true"] {
5860
+ opacity: 0.5;
5861
+ cursor: default;
5862
+ pointer-events: none;
5863
+ }
5864
+ .radio {
5865
+ width: 18px;
5866
+ height: 18px;
5867
+ min-width: 18px;
5868
+ border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
5869
+ border-radius: 50%;
5870
+ display: flex;
5871
+ align-items: center;
5872
+ justify-content: center;
5873
+ transition: border-color 150ms;
5874
+ background: var(--ap-background, oklch(1 0 0));
5875
+ }
5876
+ .radio .dot {
5877
+ width: 10px;
5878
+ height: 10px;
5879
+ border-radius: 50%;
5880
+ background: transparent;
5881
+ transition: background 150ms;
5882
+ }
5883
+ .option:hover .radio {
5884
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
5885
+ }
5886
+ .option[aria-checked="true"] .radio {
5887
+ border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
5888
+ }
5889
+ .option[aria-checked="true"] .radio .dot {
5890
+ background: var(--ap-primary, oklch(0.578 0.198 268.129));
5891
+ }
5892
+ .label {
5893
+ font-size: var(--ap-font-size-sm, 0.875rem);
5894
+ color: var(--ap-foreground, oklch(0.37 0.022 248.413));
5895
+ font-family: inherit;
5896
+ user-select: none;
5897
+ }
5898
+ `];Ue([c.property()],he.prototype,"value",2);Ue([c.property({type:Array})],he.prototype,"options",2);Ue([c.property({type:Boolean})],he.prototype,"disabled",2);Ue([c.property({reflect:!0})],he.prototype,"direction",2);Ue([c.property({reflect:!0})],he.prototype,"columns",2);he=Ue([c.customElement("ap-radio-group")],he);var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Cs=(t,e,s,i)=>{for(var a=i>1?void 0:i?gr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ur(e,s,a),a};let pt=class extends o.LitElement{constructor(){super(...arguments),this.size=24}render(){return o.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};pt.styles=[o.css`
5454
5899
  :host {
5455
5900
  display: inline-flex;
5456
5901
  }
@@ -5463,7 +5908,102 @@
5463
5908
  @keyframes spin {
5464
5909
  to { transform: rotate(360deg); }
5465
5910
  }
5466
- `];xs([l.property({type:Number})],ot.prototype,"size",2);ot=xs([l.customElement("ap-spinner")],ot);var nr=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,gt=(t,e,s,i)=>{for(var a=i>1?void 0:i?lr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&nr(e,s,a),a};let Ae=class extends o.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return o.html`
5911
+ `];Cs([c.property({type:Number})],pt.prototype,"size",2);pt=Cs([c.customElement("ap-spinner")],pt);var fr=Object.defineProperty,mr=Object.getOwnPropertyDescriptor,_t=(t,e,s,i)=>{for(var a=i>1?void 0:i?mr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fr(e,s,a),a};let De=class extends o.LitElement{constructor(){super(...arguments),this.folders=[],this.loading=!1,this._mode="recursive"}_handleConfirm(){this.dispatchEvent(new CustomEvent("folder-resolve-confirm",{detail:{mode:this._mode},bubbles:!0,composed:!0}))}_handleCancel(){this.dispatchEvent(new CustomEvent("folder-resolve-cancel",{bubbles:!0,composed:!0}))}_handleModeChange(t){this._mode=t.detail.value}render(){const t=this.folders.length;return o.html`
5912
+ <div class="backdrop" @click=${e=>{e.target===e.currentTarget&&this._handleCancel()}}>
5913
+ <div class="dialog">
5914
+ <div class="title">Add folder contents</div>
5915
+ <div class="description">
5916
+ You selected ${t} folder${t!==1?"s":""}. How would you like to add the assets?
5917
+ </div>
5918
+ <div class="options">
5919
+ <ap-radio-group
5920
+ .value=${this._mode}
5921
+ .options=${[{value:"direct",label:"Direct assets only"},{value:"recursive",label:"All assets (including subfolders)"}]}
5922
+ @ap-change=${this._handleModeChange}
5923
+ ></ap-radio-group>
5924
+ </div>
5925
+ <div class="actions">
5926
+ <button class="btn" @click=${this._handleCancel} ?disabled=${this.loading}>Cancel</button>
5927
+ <button class="btn btn-primary" @click=${this._handleConfirm} ?disabled=${this.loading}>
5928
+ ${this.loading?o.html`<span class="loading-content"><ap-spinner .size=${14}></ap-spinner> Loading...</span>`:"Add assets"}
5929
+ </button>
5930
+ </div>
5931
+ </div>
5932
+ </div>
5933
+ `}};De.styles=[W,o.css`
5934
+ :host {
5935
+ display: block;
5936
+ }
5937
+ .backdrop {
5938
+ position: fixed;
5939
+ inset: 0;
5940
+ z-index: 100;
5941
+ background: oklch(0 0 0 / 0.4);
5942
+ display: flex;
5943
+ align-items: center;
5944
+ justify-content: center;
5945
+ }
5946
+ .dialog {
5947
+ background: var(--ap-background, oklch(1 0 0));
5948
+ border-radius: var(--ap-radius-lg, 12px);
5949
+ padding: 28px 32px;
5950
+ max-width: 440px;
5951
+ width: 90%;
5952
+ box-shadow: 0 16px 48px oklch(0 0 0 / 0.16);
5953
+ }
5954
+ .title {
5955
+ font-size: 1rem;
5956
+ font-weight: 600;
5957
+ color: var(--ap-foreground, oklch(0.37 0.022 248.413));
5958
+ margin-bottom: 8px;
5959
+ }
5960
+ .description {
5961
+ font-size: var(--ap-font-size-sm, 0.875rem);
5962
+ color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
5963
+ margin-bottom: 20px;
5964
+ line-height: 1.5;
5965
+ }
5966
+ .options {
5967
+ margin-bottom: 24px;
5968
+ }
5969
+ .actions {
5970
+ display: flex;
5971
+ justify-content: flex-end;
5972
+ gap: 12px;
5973
+ }
5974
+ .btn {
5975
+ padding: 8px 20px;
5976
+ border-radius: var(--ap-radius-sm, 6px);
5977
+ font-size: var(--ap-font-size-sm, 0.875rem);
5978
+ font-weight: 500;
5979
+ cursor: pointer;
5980
+ transition: background 100ms;
5981
+ font-family: var(--ap-font-family, system-ui, sans-serif);
5982
+ border: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
5983
+ background: var(--ap-background, oklch(1 0 0));
5984
+ color: var(--ap-foreground, oklch(0.37 0.022 248.413));
5985
+ }
5986
+ .btn:not(.btn-primary):hover {
5987
+ background: var(--ap-muted, oklch(0.974 0.006 239.819));
5988
+ }
5989
+ .btn-primary {
5990
+ background: var(--ap-primary, oklch(0.578 0.198 268.129));
5991
+ color: var(--ap-primary-foreground, oklch(1 0 0));
5992
+ border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
5993
+ }
5994
+ .btn-primary:hover {
5995
+ opacity: 0.9;
5996
+ }
5997
+ .btn:disabled {
5998
+ opacity: 0.5;
5999
+ cursor: default;
6000
+ }
6001
+ .btn-primary .loading-content {
6002
+ display: flex;
6003
+ align-items: center;
6004
+ gap: 8px;
6005
+ }
6006
+ `];_t([c.property({type:Array})],De.prototype,"folders",2);_t([c.property({type:Boolean})],De.prototype,"loading",2);_t([c.state()],De.prototype,"_mode",2);De=_t([c.customElement("ap-folder-resolve-dialog")],De);var vr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,yt=(t,e,s,i)=>{for(var a=i>1?void 0:i?br(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vr(e,s,a),a};let ze=class extends o.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return o.html`
5467
6007
  <div class="box">
5468
6008
  <svg class="check" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
5469
6009
  <path d="M20 6 9 17l-5-5"></path>
@@ -5473,7 +6013,7 @@
5473
6013
  </svg>
5474
6014
  </div>
5475
6015
  <span class="label" ?hidden=${!this._hasLabel}><slot @slotchange=${this._onSlotChange}></slot></span>
5476
- `}};Ae.styles=[o.css`
6016
+ `}};ze.styles=[o.css`
5477
6017
  :host {
5478
6018
  display: inline-flex;
5479
6019
  align-items: center;
@@ -5532,12 +6072,12 @@
5532
6072
  .label[hidden] {
5533
6073
  display: none;
5534
6074
  }
5535
- `];gt([l.property({type:Boolean,reflect:!0})],Ae.prototype,"checked",2);gt([l.property({type:Boolean,reflect:!0})],Ae.prototype,"indeterminate",2);gt([l.property({type:Boolean,reflect:!0})],Ae.prototype,"disabled",2);Ae=gt([l.customElement("ap-checkbox")],Ae);var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,ws=(t,e,s,i)=>{for(var a=i>1?void 0:i?dr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&cr(e,s,a),a};let nt=class extends o.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return o.html`
6075
+ `];yt([c.property({type:Boolean,reflect:!0})],ze.prototype,"checked",2);yt([c.property({type:Boolean,reflect:!0})],ze.prototype,"indeterminate",2);yt([c.property({type:Boolean,reflect:!0})],ze.prototype,"disabled",2);ze=yt([c.customElement("ap-checkbox")],ze);var _r=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,Es=(t,e,s,i)=>{for(var a=i>1?void 0:i?yr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_r(e,s,a),a};let ht=class extends o.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return o.html`
5536
6076
  <slot name="trigger" @click=${()=>this.open=!this.open}></slot>
5537
6077
  <div class="content ${this.open?"open":""}">
5538
6078
  <slot></slot>
5539
6079
  </div>
5540
- `}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};nt.styles=[o.css`
6080
+ `}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};ht.styles=[o.css`
5541
6081
  :host {
5542
6082
  position: relative;
5543
6083
  display: inline-block;
@@ -5558,7 +6098,7 @@
5558
6098
  .content.open {
5559
6099
  display: block;
5560
6100
  }
5561
- `];ws([l.state()],nt.prototype,"open",2);nt=ws([l.customElement("ap-popover")],nt);var pr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,N=(t,e,s,i)=>{for(var a=i>1?void 0:i?hr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&pr(e,s,a),a};let I=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return o.html`
6101
+ `];Es([c.state()],ht.prototype,"open",2);ht=Es([c.customElement("ap-popover")],ht);var xr=Object.defineProperty,wr=Object.getOwnPropertyDescriptor,B=(t,e,s,i)=>{for(var a=i>1?void 0:i?wr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xr(e,s,a),a};let z=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return o.html`
5562
6102
  <button
5563
6103
  class="trigger"
5564
6104
  role="combobox"
@@ -5597,7 +6137,7 @@
5597
6137
  `)}
5598
6138
  </div>
5599
6139
  `:o.nothing}
5600
- `}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};I.styles=[J,o.css`
6140
+ `}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};z.styles=[W,o.css`
5601
6141
  :host {
5602
6142
  position: relative;
5603
6143
  display: inline-block;
@@ -5677,7 +6217,7 @@
5677
6217
  .option[aria-selected="true"] ap-icon {
5678
6218
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
5679
6219
  }
5680
- `];N([l.property()],I.prototype,"value",2);N([l.property()],I.prototype,"label",2);N([l.property({reflect:!0})],I.prototype,"variant",2);N([l.property({type:Array})],I.prototype,"options",2);N([l.state()],I.prototype,"_open",2);N([l.state()],I.prototype,"_focusedIndex",2);N([l.state()],I.prototype,"_menuPosition",2);N([l.state()],I.prototype,"_menuAlign",2);N([l.state()],I.prototype,"_menuTop",2);N([l.state()],I.prototype,"_menuBottom",2);N([l.state()],I.prototype,"_menuLeft",2);N([l.state()],I.prototype,"_menuRight",2);I=N([l.customElement("ap-dropdown")],I);var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,$s=(t,e,s,i)=>{for(var a=i>1?void 0:i?gr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ur(e,s,a),a};let lt=class extends o.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return o.html`<span class="badge"><slot></slot></span>`}};lt.styles=[o.css`
6220
+ `];B([c.property()],z.prototype,"value",2);B([c.property()],z.prototype,"label",2);B([c.property({reflect:!0})],z.prototype,"variant",2);B([c.property({type:Array})],z.prototype,"options",2);B([c.state()],z.prototype,"_open",2);B([c.state()],z.prototype,"_focusedIndex",2);B([c.state()],z.prototype,"_menuPosition",2);B([c.state()],z.prototype,"_menuAlign",2);B([c.state()],z.prototype,"_menuTop",2);B([c.state()],z.prototype,"_menuBottom",2);B([c.state()],z.prototype,"_menuLeft",2);B([c.state()],z.prototype,"_menuRight",2);z=B([c.customElement("ap-dropdown")],z);var $r=Object.defineProperty,kr=Object.getOwnPropertyDescriptor,Fs=(t,e,s,i)=>{for(var a=i>1?void 0:i?kr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$r(e,s,a),a};let ut=class extends o.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return o.html`<span class="badge"><slot></slot></span>`}};ut.styles=[o.css`
5681
6221
  :host {
5682
6222
  display: inline-flex;
5683
6223
  }
@@ -5696,10 +6236,10 @@
5696
6236
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
5697
6237
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
5698
6238
  }
5699
- `];$s([l.property({reflect:!0})],lt.prototype,"variant",2);lt=$s([l.customElement("ap-badge")],lt);var fr=Object.defineProperty,mr=Object.getOwnPropertyDescriptor,ks=(t,e,s,i)=>{for(var a=i>1?void 0:i?mr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fr(e,s,a),a};let ct=class extends o.LitElement{constructor(){super(...arguments),this.text=""}render(){return o.html`
6239
+ `];Fs([c.property({reflect:!0})],ut.prototype,"variant",2);ut=Fs([c.customElement("ap-badge")],ut);var Sr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,As=(t,e,s,i)=>{for(var a=i>1?void 0:i?Cr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Sr(e,s,a),a};let gt=class extends o.LitElement{constructor(){super(...arguments),this.text=""}render(){return o.html`
5700
6240
  <slot></slot>
5701
6241
  <div class="tip">${this.text}</div>
5702
- `}};ct.styles=[o.css`
6242
+ `}};gt.styles=[o.css`
5703
6243
  :host {
5704
6244
  position: relative;
5705
6245
  display: inline-flex;
@@ -5722,85 +6262,10 @@
5722
6262
  :host(:hover) .tip {
5723
6263
  display: block;
5724
6264
  }
5725
- `];ks([l.property()],ct.prototype,"text",2);ct=ks([l.customElement("ap-tooltip")],ct);var vr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,Pe=(t,e,s,i)=>{for(var a=i>1?void 0:i?br(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vr(e,s,a),a};let ne=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(a=>!this.disabled&&!a.disabled);if(e.length===0)return;const s=e.findIndex(a=>a.value===this.value);let i=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),i=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),i=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}i!==null&&this._select(e[i])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return o.html`
5726
- ${this.options.map(t=>o.html`
5727
- <div
5728
- class="option"
5729
- role="radio"
5730
- aria-checked=${t.value===this.value}
5731
- aria-disabled=${this.disabled||t.disabled?"true":o.nothing}
5732
- @click=${()=>this._select(t)}
5733
- >
5734
- <div class="radio"><div class="dot"></div></div>
5735
- ${t.icon?o.html`<ap-icon name=${t.icon} .size=${16}></ap-icon>`:o.nothing}
5736
- <span class="label">${t.label}</span>
5737
- </div>
5738
- `)}
5739
- `}_select(t){this.disabled||t.disabled||this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t.value},bubbles:!0,composed:!0}))}};ne.styles=[J,o.css`
5740
- :host {
5741
- display: flex;
5742
- flex-direction: column;
5743
- gap: 6px;
5744
- }
5745
- :host([direction="horizontal"]) {
5746
- flex-direction: row;
5747
- gap: 16px;
5748
- }
5749
- :host([columns="2"]) {
5750
- display: grid;
5751
- grid-template-columns: 1fr 1fr;
5752
- gap: 8px;
5753
- }
5754
- .option {
5755
- display: flex;
5756
- align-items: center;
5757
- gap: 8px;
5758
- cursor: pointer;
5759
- padding: 2px 0;
5760
- }
5761
- .option[aria-disabled="true"] {
5762
- opacity: 0.5;
5763
- cursor: default;
5764
- pointer-events: none;
5765
- }
5766
- .radio {
5767
- width: 18px;
5768
- height: 18px;
5769
- min-width: 18px;
5770
- border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
5771
- border-radius: 50%;
5772
- display: flex;
5773
- align-items: center;
5774
- justify-content: center;
5775
- transition: border-color 150ms;
5776
- background: var(--ap-background, oklch(1 0 0));
5777
- }
5778
- .radio .dot {
5779
- width: 10px;
5780
- height: 10px;
5781
- border-radius: 50%;
5782
- background: transparent;
5783
- transition: background 150ms;
5784
- }
5785
- .option:hover .radio {
5786
- border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
5787
- }
5788
- .option[aria-checked="true"] .radio {
5789
- border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
5790
- }
5791
- .option[aria-checked="true"] .radio .dot {
5792
- background: var(--ap-primary, oklch(0.578 0.198 268.129));
5793
- }
5794
- .label {
5795
- font-size: var(--ap-font-size-sm, 0.875rem);
5796
- color: var(--ap-foreground, oklch(0.37 0.022 248.413));
5797
- font-family: inherit;
5798
- user-select: none;
5799
- }
5800
- `];Pe([l.property()],ne.prototype,"value",2);Pe([l.property({type:Array})],ne.prototype,"options",2);Pe([l.property({type:Boolean})],ne.prototype,"disabled",2);Pe([l.property({reflect:!0})],ne.prototype,"direction",2);Pe([l.property({reflect:!0})],ne.prototype,"columns",2);ne=Pe([l.customElement("ap-radio-group")],ne);var _r=Object.defineProperty,Rt=(t,e,s,i)=>{for(var a=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=n(e,s,a)||a);return a&&_r(e,s,a),a};const Nt=class Nt extends o.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var i,a;if(!((i=this.config)!=null&&i.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((a=e.dataTransfer)==null?void 0:a.files)??[]);s.length>0&&this._openUploader(s)},this.store=Ls(),this.storeCtrl=new Ps(this,this.store),this.selectionCtrl=new Is(this,this.store),this.infiniteScrollCtrl=new Ds(this,()=>this._loadMore()),this.marqueeCtrl=new zs(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const a=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,a)}const i=this.renderRoot.querySelector(".main-content");i&&i!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=i,this.marqueeCtrl.attach(i))}_initConfig(e){this._initFailed=!1,this._initPromise=this._doInit(e).catch(()=>{this._initFailed=!0}),e.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Sa(),i=s.sortBy??e.defaultSortBy??"created_at",a=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Fa()||e.defaultViewMode||"grid",sortBy:i,sortDirection:a,currentFolder:null,currentFolderPath:e.rootFolderPath??"/"}),this.apiClient=new Rs(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const p=await qs(this.apiClient);this.apiClient.setSassKey(p),this.store.setState({sassKey:p})}const[r,n,c]=await Promise.allSettled([oa(this.apiClient),Bs(this.apiClient),Vs(this.apiClient)]);if(r.status==="fulfilled"){const{fields:p,regionalVariantGroups:g,regionalFilters:v,brandColor:x}=r.value;this.store.setState({metadataFields:p,regionalVariantGroups:g,regionalFilters:v,...x?{brandColor:x}:{}})}n.status==="fulfilled"&&this.store.setState({labels:n.value.labels||[]}),c.status==="fulfilled"&&this.store.setState({tags:c.value});const{pinnedFilters:d,pinnedMetadata:h}=wa(e.auth.projectToken??null),u=this.store.getState().filters;this.store.setState({filters:{...u,pinned:d,visible:[...d],metadata:{...u.metadata,pinned:h,visible:[...h]}}});const f=e.brandColor||this.store.getState().brandColor;f&&(this.store.setState({brandColor:f}),Pa(this,f))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,i=this.store.getState();let a;return e.auth.mode==="securityTemplate"?a={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:a={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:a,targetFolder:i.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,headerButton:s.headerButton??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay}}async _openUploader(e){var i;if(!((i=this.config)!=null&&i.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(a){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a instanceof Error?a:new Error(String(a)),context:"uploader-load"},bubbles:!0,composed:!0}));return}this._uploaderEl=document.createElement("sfx-uploader");const s=this._uploaderEl;s.addEventListener("sfx-all-complete",()=>{this.store.getState().isOpen&&this._loadData()}),s.addEventListener("sfx-complete-action",()=>{this._closeUploader()}),s.addEventListener("sfx-cancel",()=>{this._closeUploader()}),this._isUploaderOpen=!0,await this.updateComplete,s.config=this._buildUploaderConfig(),await s.updateComplete,e!=null&&e.length&&s.addFiles(e)}_closeUploader(){this._isUploaderOpen=!1,this._uploaderEl=null}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,i;return!!((i=(s=e.dataTransfer)==null?void 0:s.types)!=null&&i.includes("Files"))}async open(){var u,f,p,g,v,x,b;const e=this.store.getState(),s=De((u=this.config)==null?void 0:u.forcedFilters),i=new Set(Object.keys(s)),a={},r=De((f=this.config)==null?void 0:f.defaultFilters);for(const[k,$]of Object.entries(r))i.has(k)||(a[k]=$);const n=Object.keys(a),c=((p=this.config)==null?void 0:p.tabs)??["assets","folders"],d=(g=this.config)!=null&&g.rememberLastTab?Ta():null,h=(d&&c.includes(d)?d:null)??((v=this.config)!=null&&v.defaultTab&&c.includes(this.config.defaultTab)?this.config.defaultTab:null)??c[0]??"assets";this.store.setState({isOpen:!0,activeTab:h,searchQuery:"",filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...n])],applied:a},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:((x=this.config)==null?void 0:x.rememberLastFolder)&&Ca()||((b=this.config)==null?void 0:b.rootFolderPath)||"/",breadcrumb:[],selectedAssets:new Map,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,r,n,c,d,h,u,f,p,g,v,x,b;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const k=s.activeTab;if(k==="assets"){const $=this._buildSearchNotation(),F=s.currentFolderPath||"/",j=Ye(this.apiClient,{folder:F,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:1}),S=Vt(this.apiClient,{folder:F,q:$||void 0,search:s.searchQuery||void 0,recursive:1}).catch(()=>null),[L,D]=await Promise.all([j,S]);if(e!==this._loadId)return;const se=((i=L.files)==null?void 0:i.length)??0,ce=se>=s.limit,we=((a=D==null?void 0:D.stats)==null?void 0:a.approx_files_count)??((r=D==null?void 0:D.info)==null?void 0:r.total_files_count)??((n=L.info)==null?void 0:n.total_files_count)??((d=(c=L.base)==null?void 0:c.count)==null?void 0:d.files_recursive)??((u=(h=L.base)==null?void 0:h.count)==null?void 0:u.files_direct)??se;this.store.setState({assets:L.files||[],folders:[],totalCount:we,totalFolderCount:0,offset:0,hasMore:ce,isLoading:!1})}else if(k==="folders"){const $=this._buildSearchNotation(),F=s.currentFolderPath||"/",[j,S,L]=await Promise.all([js(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Ye(this.apiClient,{folder:F,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:0}),Vt(this.apiClient,{folder:F,q:$||void 0,search:s.searchQuery||void 0,recursive:0}).catch(()=>null)]);if(e!==this._loadId)return;const D=j.folders||[];let se={};if(D.length>0)try{se=await Us(this.apiClient,D.map(de=>de.uuid))}catch{}if(e!==this._loadId)return;const ce=((f=S.files)==null?void 0:f.length)??0,we=ce>=s.limit,Ge=((p=L==null?void 0:L.stats)==null?void 0:p.approx_files_count)??((g=L==null?void 0:L.info)==null?void 0:g.total_files_count)??((v=S.info)==null?void 0:v.total_files_count)??((b=(x=S.base)==null?void 0:x.count)==null?void 0:b.files_direct)??ce;this.store.setState({assets:S.files||[],folders:D,folderPreviews:se,totalCount:Ge,totalFolderCount:j.total??D.length,offset:0,hasMore:we,isLoading:!1})}}catch(k){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:k,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient)return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const a=this._buildSearchNotation(),r=await Ye(this.apiClient,{folder:e.currentFolderPath||"/",offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:a||void 0,recursive:e.activeTab==="folders"?0:1});if(s!==this._loadMoreId)return;const n=this.store.getState().assets,c=r.files||[],d=c.length>=e.limit,h=[...n,...c];this.store.setState({assets:h,offset:i,hasMore:d,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,i;this.close(),(i=(s=this.config)==null?void 0:s.onCancel)==null||i.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){this.store.setState({searchQuery:e.detail.value,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&Ea(s),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:i}=e.detail,a=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...a,[s]:i}})}_handleSortChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),Wt(s,i.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),Wt(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&Aa(s),this.store.setState({activeTab:s,currentFolder:null,currentFolderPath:((a=this.config)==null?void 0:a.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i,a;const s=e.detail.asset;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,[s]),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:[s]},bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var r;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&Qt(a),this.store.setState({currentFolder:s.uuid,currentFolderPath:a,breadcrumb:[...i.breadcrumb,{uuid:s.uuid,name:s.name,path:a}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var c,d;const s=e.detail.uuid,i=this.store.getState(),a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?i.breadcrumb.slice(0,a+1):[],n=r.length>0?r[r.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Qt(n),this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:r,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var i,a;const s=e.detail.assets;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleSelectAll(){var i;const e=this.store.getState();if(!(e.isSelectingAll||!this.apiClient||!(((i=e.config)==null?void 0:i.multiSelect)??!0))){if(e.assets.length>=e.totalCount){this.selectionCtrl.selectAll(e.assets);return}this.store.setState({isSelectingAll:!0});try{const a=this._buildSearchNotation(),r=e.currentFolderPath||"/",n=e.limit,c=e.assets,d=e.totalCount,h=e.activeTab==="folders"?0:1,u=[];for(let b=c.length;b<d;b+=n)u.push(b);const f=4,p=[];for(let b=0;b<u.length;b+=f){const k=u.slice(b,b+f),$=await Promise.all(k.map(F=>Ye(this.apiClient,{folder:r,offset:F,limit:n,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:a||void 0,recursive:h})));for(const F of $)F.files&&p.push(...F.files)}const g=new Set(c.map(b=>b.uuid)),v=p.filter(b=>g.has(b.uuid)?!1:(g.add(b.uuid),!0)),x=[...c,...v];this.store.setState({assets:x,offset:Math.max(0,x.length-n),hasMore:!1,isSelectingAll:!1}),this.selectionCtrl.selectAll(x)}catch(a){this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a,context:"selectAll"},bubbles:!0,composed:!0}))}}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===m.DATE||e===m.LICENSE_EXPIRY||e===z.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let c=i===""||i===null||i===void 0||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!c&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:f}=i;c=!d&&!h&&!u&&!f}if(c){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)?d[s]={type:"date",field:i.field||"created",kind:i.kind||null,preset:i.preset||null,from:i.from||null,to:i.to||null}:s===m.IMAGE&&typeof i=="object"&&!Array.isArray(i)?d[s]=i:d[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,i=e.detail.chipRect,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,r,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,r,n)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var p,g,v;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!r)return;i?(this._pendingMetadataField=i,a.pendingMetadataField=i):s&&(this._pendingFilter=s,a.pendingFilter=s),await a.updateComplete;let n=a.renderRoot.querySelector(".chip.pending");if(!n){const x=a.renderRoot.querySelectorAll(".chip.pinned-empty"),b=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const k of x){const $=(v=(g=k.querySelector(".chip-label"))==null?void 0:g.textContent)==null?void 0:v.trim();if(i&&$===b){n=k;break}if(s&&$===(ke[s]||s)){n=k;break}}}if(!n)return;const c=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?c.left-h.left:c.left,f=h?c.bottom-h.top:void 0;i?r.openMetadataFieldPanel(i,!0,u,f):s&&r.openFilterPanel(s,!0,u,f)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const a={...this.store.getState().filters},r={...a.applied};delete r[s],a.applied=r,a.pinned.includes(s)||(a.visible=a.visible.filter(c=>c!==s)),this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:i,values:a,metadataType:r}=e.detail,c={...this.store.getState().filters},d={...c.metadata},h={...d.applied};if(!a||Array.isArray(a)&&a.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:r},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),c.metadata=d,this.store.setState({filters:c,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const f=this.renderRoot.querySelector("ap-filters-bar");f&&(f.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(c=>c!==s)),a.metadata=r,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var c,d;const{key:s,pinned:i}=e.detail,r={...this.store.getState().filters};i?r.pinned.includes(s)||(r.pinned=[...r.pinned,s]):(r.pinned=r.pinned.filter(h=>h!==s),s in r.applied||(r.visible=r.visible.filter(h=>h!==s))),this.store.setState({filters:r});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;$a(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),r.metadata=n,this.store.setState({filters:r});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;ka(c,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,a={...this.store.getState().filters};a.visible=a.visible.filter(r=>r!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata};r.visible=r.visible.filter(n=>n!==s),a.metadata=r,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,r={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),c={...s};for(const u of n)delete c[u];r.applied=c;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],i){const u={...r.metadata};u.applied=i.applied;const f=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...f])],r.metadata=u}this.store.setState({filters:r,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){const e=this.storeCtrl.state;return e.searchQuery?Ia:e.activeTab==="folders"?Da:At}_buildSearchNotation(){var a;const e=this.store.getState(),s={...De((a=this.config)==null?void 0:a.forcedFilters),...e.filters.applied};return ca(s,e.filters.metadata.applied).join(" ")}render(){var h,u,f,p,g,v,x,b;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=this.selectionCtrl.getSelectedAssets(),a=o.html`
6265
+ `];As([c.property()],gt.prototype,"text",2);gt=As([c.customElement("ap-tooltip")],gt);var Er=Object.defineProperty,xt=(t,e,s,i)=>{for(var a=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=n(e,s,a)||a);return a&&Er(e,s,a),a};const Vt=class Vt extends o.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var i,a;if(!((i=this.config)!=null&&i.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((a=e.dataTransfer)==null?void 0:a.files)??[]);s.length>0&&this._openUploader(s)},this.store=Rs(),this.storeCtrl=new Ns(this,this.store),this.selectionCtrl=new Bs(this,this.store),this.infiniteScrollCtrl=new Us(this,()=>this._loadMore()),this.marqueeCtrl=new Vs(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const a=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,a)}const i=this.renderRoot.querySelector(".main-content");i&&i!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=i,this.marqueeCtrl.attach(i))}_initConfig(e){const s={folderSelection:!0,...e};this._initFailed=!1,this._initPromise=this._doInit(s).catch(()=>{this._initFailed=!0}),this.toggleAttribute("inline",s.displayMode==="inline"),s.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Mi(),i=s.sortBy??e.defaultSortBy??"created_at",a=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Oi()||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new qs(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const p=await Ws(this.apiClient);this.apiClient.setSassKey(p),this.store.setState({sassKey:p})}const[r,n,l]=await Promise.allSettled([hi(this.apiClient),Ys(this.apiClient),Xs(this.apiClient)]);if(r.status==="fulfilled"){const{fields:p,regionalVariantGroups:g,regionalFilters:m,brandColor:y}=r.value;this.store.setState({metadataFields:p,regionalVariantGroups:g,regionalFilters:m,...y?{brandColor:y}:{}})}n.status==="fulfilled"&&this.store.setState({labels:n.value.labels||[]}),l.status==="fulfilled"&&this.store.setState({tags:l.value});const{pinnedFilters:d,pinnedMetadata:h}=Fi(e.auth.projectToken??null),u=this.store.getState().filters;this.store.setState({filters:{...u,pinned:d,visible:[...d],metadata:{...u.metadata,pinned:h,visible:[...h]}}});const f=e.brandColor||this.store.getState().brandColor;f&&(this.store.setState({brandColor:f}),Ni(this,f))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,i=this.store.getState();let a;return e.auth.mode==="securityTemplate"?a={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:a={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:a,targetFolder:i.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,headerButton:s.headerButton??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay}}async _openUploader(e){var i;if(!((i=this.config)!=null&&i.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(a){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a instanceof Error?a:new Error(String(a)),context:"uploader-load"},bubbles:!0,composed:!0}));return}this._uploaderEl=document.createElement("sfx-uploader");const s=this._uploaderEl;s.addEventListener("sfx-all-complete",()=>{this.store.getState().isOpen&&this._loadData()}),s.addEventListener("sfx-complete-action",()=>{this._closeUploader()}),s.addEventListener("sfx-cancel",()=>{this._closeUploader()}),this._isUploaderOpen=!0,await this.updateComplete,s.config=this._buildUploaderConfig(),await s.updateComplete,e!=null&&e.length&&s.addFiles(e)}_closeUploader(){this._isUploaderOpen=!1,this._uploaderEl=null}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,i;return!!((i=(s=e.dataTransfer)==null?void 0:s.types)!=null&&i.includes("Files"))}async open(){var u,f,p,g,m,y,x,S,b,C;const e=this.store.getState(),s=He((u=this.config)==null?void 0:u.forcedFilters),i=new Set(Object.keys(s)),a={},r=He((f=this.config)==null?void 0:f.defaultFilters);for(const[T,$]of Object.entries(r))i.has(T)||(a[T]=$);const n=Object.keys(a),l=((p=this.config)==null?void 0:p.tabs)??["assets","folders"],d=(g=this.config)!=null&&g.rememberLastTab?Ii():null,h=(d&&l.includes(d)?d:null)??((m=this.config)!=null&&m.defaultTab&&l.includes(this.config.defaultTab)?this.config.defaultTab:null)??l[0]??"assets";this.store.setState({isOpen:!0,activeTab:h,searchQuery:"",filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...n])],applied:a},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:h==="folders"&&((y=this.config)==null?void 0:y.rememberLastFolder)&&ss()||((x=this.config)==null?void 0:x.rootFolderPath)||"/",breadcrumb:this._buildBreadcrumbFromPath(h==="folders"&&((S=this.config)==null?void 0:S.rememberLastFolder)&&ss()||((b=this.config)==null?void 0:b.rootFolderPath)||"/",((C=this.config)==null?void 0:C.rootFolderPath)||"/"),selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,r,n,l,d,h,u,f,p,g,m,y,x;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const S=s.activeTab;if(S==="assets"){const b=this._buildSearchNotation(),C=s.currentFolderPath||"/",T=Ve(this.apiClient,{folder:C,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:b||void 0,recursive:1}),$=Gt(this.apiClient,{folder:C,q:b||void 0,search:s.searchQuery||void 0,recursive:1}).catch(()=>null),[L,P]=await Promise.all([T,$]);if(e!==this._loadId)return;const X=((i=L.files)==null?void 0:i.length)??0,ue=X>=s.limit,Fe=((a=P==null?void 0:P.stats)==null?void 0:a.approx_files_count)??((r=P==null?void 0:P.info)==null?void 0:r.total_files_count)??((n=L.info)==null?void 0:n.total_files_count)??((d=(l=L.base)==null?void 0:l.count)==null?void 0:d.files_recursive)??((u=(h=L.base)==null?void 0:h.count)==null?void 0:u.files_direct)??X;this.store.setState({assets:L.files||[],folders:[],totalCount:Fe,totalFolderCount:0,offset:0,hasMore:ue,isLoading:!1})}else if(S==="folders"){const b=this._buildSearchNotation(),C=s.currentFolderPath||"/",[T,$,L]=await Promise.all([Ks(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Ve(this.apiClient,{folder:C,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:b||void 0,recursive:0}),Gt(this.apiClient,{folder:C,q:b||void 0,search:s.searchQuery||void 0,recursive:0}).catch(()=>null)]);if(e!==this._loadId)return;const P=T.folders||[];let X={};if(P.length>0)try{X=await Gs(this.apiClient,P.map(ge=>ge.uuid))}catch{}if(e!==this._loadId)return;const ue=((f=$.files)==null?void 0:f.length)??0,Fe=ue>=s.limit,tt=((p=L==null?void 0:L.stats)==null?void 0:p.approx_files_count)??((g=L==null?void 0:L.info)==null?void 0:g.total_files_count)??((m=$.info)==null?void 0:m.total_files_count)??((x=(y=$.base)==null?void 0:y.count)==null?void 0:x.files_direct)??ue;this.store.setState({assets:$.files||[],folders:P,folderPreviews:X,totalCount:tt,totalFolderCount:T.total??P.length,offset:0,hasMore:Fe,isLoading:!1})}}catch(S){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:S,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient)return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const a=this._buildSearchNotation(),r=await Ve(this.apiClient,{folder:e.currentFolderPath||"/",offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:a||void 0,recursive:e.activeTab==="folders"?0:1});if(s!==this._loadMoreId)return;const n=this.store.getState().assets,l=r.files||[],d=l.length>=e.limit,h=[...n,...l];this.store.setState({assets:h,offset:i,hasMore:d,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,i;this.close(),(i=(s=this.config)==null?void 0:s.onCancel)==null||i.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){this.store.setState({searchQuery:e.detail.value,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&Li(s),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:i}=e.detail,a=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...a,[s]:i}})}_handleSortChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),es(s,i.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),es(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&Pi(s),this.store.setState({activeTab:s,currentFolder:null,currentFolderPath:((a=this.config)==null?void 0:a.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleFolderSelect(e){this.selectionCtrl.handleFolderSelect(e.detail.folder,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i,a;const s=e.detail.asset;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,[s]),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:[s]},bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var r;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&ts(a),this.store.setState({currentFolder:s.uuid,currentFolderPath:a,breadcrumb:[...i.breadcrumb,{uuid:s.uuid,name:s.name,path:a}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var l,d;const s=e.detail.uuid,i=this.store.getState(),a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?i.breadcrumb.slice(0,a+1):[],n=r.length>0?r[r.length-1].path:((l=this.config)==null?void 0:l.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&ts(n),this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:r,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_buildBreadcrumbFromPath(e,s){if(!e||e===s||e==="/")return[];const a=(e.startsWith(s)?e.slice(s.length):e.replace(/^\//,"")).split("/").filter(Boolean),r=[];let n=s.endsWith("/")?s:s+"/";for(const l of a)n+=l+"/",r.push({uuid:n,name:l,path:n});return r}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,r,n,l,d,h;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1){if(((r=this.config)==null?void 0:r.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}(l=(n=this.config)==null?void 0:n.onSelect)==null||l.call(n,s,i),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s,folders:i},bubbles:!0,composed:!0})),this._isInline||this.close();return}(h=(d=this.config)==null?void 0:d.onSelect)==null||h.call(d,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleFolderResolveConfirm(e){var r,n,l;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const d=await Promise.all(i.map(m=>Ve(this.apiClient,{folder:m.path,recursive:s==="recursive"?1:0,limit:1e4}))),h=[];for(const m of d)h.push(...m.files);const u=[...a],f=new Set(u.map(m=>m.uuid));for(const m of h)f.has(m.uuid)||(u.push(m),f.add(m.uuid));const p=(r=this.config)==null?void 0:r.maxSelections,g=p?u.slice(0,p):u;(l=(n=this.config)==null?void 0:n.onSelect)==null||l.call(n,g),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:g},bubbles:!0,composed:!0})),this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._isInline||this.close()}catch(d){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:d,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1}async _handleSelectAll(){var i,a,r;const e=this.store.getState();if(!(e.isSelectingAll||!this.apiClient||!(((i=e.config)==null?void 0:i.multiSelect)??!0))){if(e.assets.length>=e.totalCount){((a=this.config)==null?void 0:a.folderSelection)!==!1&&e.folders.length>0&&this.selectionCtrl.selectAllFolders(e.folders),this.selectionCtrl.selectAll(e.assets);return}this.store.setState({isSelectingAll:!0});try{const n=this._buildSearchNotation(),l=e.currentFolderPath||"/",d=e.limit,h=e.assets,u=e.totalCount,f=e.activeTab==="folders"?0:1,p=[];for(let b=h.length;b<u;b+=d)p.push(b);const g=4,m=[];for(let b=0;b<p.length;b+=g){const C=p.slice(b,b+g),T=await Promise.all(C.map($=>Ve(this.apiClient,{folder:l,offset:$,limit:d,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:n||void 0,recursive:f})));for(const $ of T)$.files&&m.push(...$.files)}const y=new Set(h.map(b=>b.uuid)),x=m.filter(b=>y.has(b.uuid)?!1:(y.add(b.uuid),!0)),S=[...h,...x];this.store.setState({assets:S,offset:Math.max(0,S.length-d),hasMore:!1,isSelectingAll:!1}),((r=this.config)==null?void 0:r.folderSelection)!==!1&&e.folders.length>0&&this.selectionCtrl.selectAllFolders(e.folders),this.selectionCtrl.selectAll(S)}catch(n){this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:n,context:"selectAll"},bubbles:!0,composed:!0}))}}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===v.DATE||e===v.LICENSE_EXPIRY||e===R.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let l=i===""||i===null||i===void 0||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!l&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:f}=i;l=!d&&!h&&!u&&!f}if(l){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)?d[s]={type:"date",field:i.field||"created",kind:i.kind||null,preset:i.preset||null,from:i.from||null,to:i.to||null}:s===v.IMAGE&&typeof i=="object"&&!Array.isArray(i)?d[s]=i:d[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,i=e.detail.chipRect,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const l=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(l){const d=l.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,r,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const l=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(l){const d=l.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,r,n)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var p,g,m;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!r)return;i?(this._pendingMetadataField=i,a.pendingMetadataField=i):s&&(this._pendingFilter=s,a.pendingFilter=s),await a.updateComplete;let n=a.renderRoot.querySelector(".chip.pending");if(!n){const y=a.renderRoot.querySelectorAll(".chip.pinned-empty"),x=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const S of y){const b=(m=(g=S.querySelector(".chip-label"))==null?void 0:g.textContent)==null?void 0:m.trim();if(i&&b===x){n=S;break}if(s&&b===(Te[s]||s)){n=S;break}}}if(!n)return;const l=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?l.left-h.left:l.left,f=h?l.bottom-h.top:void 0;i?r.openMetadataFieldPanel(i,!0,u,f):s&&r.openFilterPanel(s,!0,u,f)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const a={...this.store.getState().filters},r={...a.applied};delete r[s],a.applied=r,a.pinned.includes(s)||(a.visible=a.visible.filter(l=>l!==s)),this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:i,values:a,metadataType:r}=e.detail,l={...this.store.getState().filters},d={...l.metadata},h={...d.applied};if(!a||Array.isArray(a)&&a.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:r},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),l.metadata=d,this.store.setState({filters:l,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const f=this.renderRoot.querySelector("ap-filters-bar");f&&(f.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(l=>l!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(l=>l!==s)),a.metadata=r,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var l,d;const{key:s,pinned:i}=e.detail,r={...this.store.getState().filters};i?r.pinned.includes(s)||(r.pinned=[...r.pinned,s]):(r.pinned=r.pinned.filter(h=>h!==s),s in r.applied||(r.visible=r.visible.filter(h=>h!==s))),this.store.setState({filters:r});const n=((d=(l=this.store.getState().config)==null?void 0:l.auth)==null?void 0:d.projectToken)??null;Ai(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),r.metadata=n,this.store.setState({filters:r});const l=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;Ti(l,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,a={...this.store.getState().filters};a.visible=a.visible.filter(r=>r!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata};r.visible=r.visible.filter(n=>n!==s),a.metadata=r,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,r={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),l={...s};for(const u of n)delete l[u];r.applied=l;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],i){const u={...r.metadata};u.applied=i.applied;const f=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...f])],r.metadata=u}this.store.setState({filters:r,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){const e=this.storeCtrl.state;return e.searchQuery?ji:e.activeTab==="folders"?Bi:It}_buildSearchNotation(){var a;const e=this.store.getState(),s={...He((a=this.config)==null?void 0:a.forcedFilters),...e.filters.applied};return fi(s,e.filters.metadata.applied).join(" ")}render(){var p,g,m,y,x,S,b,C,T,$,L,P;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=Array.from(e.selectedFolders.keys()),a=this.selectionCtrl.getSelectedAssets(),r=this.selectionCtrl.getSelectedFolders(),n=((p=this.config)==null?void 0:p.folderSelection)!==!1,l=o.html`
5801
6266
  <ap-header
5802
6267
  .activeTab=${e.activeTab}
5803
- .tabs=${((h=this.config)==null?void 0:h.tabs)??["assets","folders"]}
6268
+ .tabs=${((g=this.config)==null?void 0:g.tabs)??["assets","folders"]}
5804
6269
  .viewMode=${e.viewMode}
5805
6270
  .searchQuery=${e.searchQuery}
5806
6271
  .regionalGroups=${e.regionalVariantGroups}
@@ -5812,7 +6277,7 @@
5812
6277
  @regional-change=${this._handleRegionalChange}
5813
6278
  @ap-close=${()=>this._handleCancel("close-button")}
5814
6279
  ></ap-header>
5815
- `,r=!!((u=this.config)!=null&&u.uploader),n=o.html`
6280
+ `,d=!!((m=this.config)!=null&&m.uploader),h=o.html`
5816
6281
  <div class="content-area"
5817
6282
  @dragenter=${this._onDragEnter}
5818
6283
  @dragover=${this._onDragOver}
@@ -5828,12 +6293,12 @@
5828
6293
  </div>
5829
6294
  `:o.nothing}
5830
6295
  <div class="main-content">
5831
- <div class="toolbar-filters-wrapper">
6296
+ <div class="toolbar-filters-wrapper${(y=this.config)!=null&&y.stickyFilters?" sticky":""}">
5832
6297
  <ap-content-toolbar
5833
6298
  .isLoading=${e.isLoading}
5834
6299
  .totalCount=${e.totalCount}
5835
6300
  .totalFolderCount=${e.totalFolderCount}
5836
- .showUpload=${r}
6301
+ .showUpload=${d}
5837
6302
  .sortBy=${e.sortBy}
5838
6303
  .sortDirection=${e.sortDirection}
5839
6304
  .sortOptions=${this._getSortOptions()}
@@ -5843,7 +6308,7 @@
5843
6308
  .metadataFields=${e.metadataFields}
5844
6309
  .pinnedFilters=${e.filters.pinned}
5845
6310
  .apiClient=${this.apiClient}
5846
- .forcedFilterKeys=${Object.keys(De((f=this.config)==null?void 0:f.forcedFilters))}
6311
+ .forcedFilterKeys=${Object.keys(He((x=this.config)==null?void 0:x.forcedFilters))}
5847
6312
  @sort-change=${this._handleSortChange}
5848
6313
  @sort-direction-change=${this._handleSortDirectionChange}
5849
6314
  @filter-update=${this._handleFilterUpdate}
@@ -5864,7 +6329,7 @@
5864
6329
  .labels=${e.labels}
5865
6330
  .pinnedFilters=${e.filters.pinned}
5866
6331
  .pinnedMetadataFields=${e.filters.metadata.pinned}
5867
- .forcedFilters=${((p=this.config)==null?void 0:p.forcedFilters)??{}}
6332
+ .forcedFilters=${((S=this.config)==null?void 0:S.forcedFilters)??{}}
5868
6333
  @filter-remove=${this._handleFilterRemove}
5869
6334
  @filter-deactivate=${this._handleFilterDeactivate}
5870
6335
  @filter-open=${this._handleFilterOpen}
@@ -5882,9 +6347,17 @@
5882
6347
  ></ap-breadcrumb>`:o.nothing}
5883
6348
  </div>
5884
6349
 
5885
- ${e.isLoading&&e.assets.length===0&&e.folders.length===0?o.html`<ap-skeleton .variant=${e.viewMode}></ap-skeleton>`:this._renderContent(e,s)}
6350
+ ${e.isLoading&&e.assets.length===0&&e.folders.length===0?o.html`<ap-skeleton .variant=${e.viewMode} .gridSize=${((b=this.config)==null?void 0:b.gridSize)??"normal"} .multiSelect=${((C=this.config)==null?void 0:C.multiSelect)!==!1} .folderCount=${2}></ap-skeleton>`:this._renderContent(e,s,i,n)}
5886
6351
 
5887
6352
  <ap-marquee-overlay .active=${this.marqueeCtrl.isActive} .rect=${this.marqueeCtrl.rect}></ap-marquee-overlay>
6353
+ ${this._folderResolveOpen?o.html`
6354
+ <ap-folder-resolve-dialog
6355
+ .folders=${r}
6356
+ .loading=${e.isResolvingFolders}
6357
+ @folder-resolve-confirm=${this._handleFolderResolveConfirm}
6358
+ @folder-resolve-cancel=${this._handleFolderResolveCancel}
6359
+ ></ap-folder-resolve-dialog>
6360
+ `:o.nothing}
5888
6361
  </div>
5889
6362
 
5890
6363
  ${e.isPreviewOpen&&e.previewAsset?o.html`<ap-preview-panel
@@ -5892,11 +6365,11 @@
5892
6365
  .assets=${e.assets}
5893
6366
  .selectedIds=${s}
5894
6367
  .containerToken=${e.projectToken}
5895
- .showMetadata=${((g=this.config)==null?void 0:g.showMetadata)!==!1}
6368
+ .showMetadata=${((T=this.config)==null?void 0:T.showMetadata)!==!1}
5896
6369
  .metadataFields=${e.metadataFields}
5897
6370
  .labels=${e.labels}
5898
6371
  .regionalFilters=${e.regionalFilters}
5899
- .multiSelect=${((v=this.config)==null?void 0:v.multiSelect)??!0}
6372
+ .multiSelect=${(($=this.config)==null?void 0:$.multiSelect)??!0}
5900
6373
  @preview-close=${this._handlePreviewClose}
5901
6374
  @preview-navigate=${this._handlePreviewNavigate}
5902
6375
  @asset-select=${this._handleAssetSelect}
@@ -5904,19 +6377,20 @@
5904
6377
  @filter-update=${this._handleFilterUpdate}
5905
6378
  ></ap-preview-panel>`:o.nothing}
5906
6379
  </div>
5907
- `,c=o.html`
6380
+ `,u=o.html`
5908
6381
  <ap-selection-bar
5909
- .selectedAssets=${i}
6382
+ .selectedAssets=${a}
6383
+ .selectedFolders=${r}
5910
6384
  .totalCount=${e.totalCount}
5911
6385
  .isSelectingAll=${e.isSelectingAll}
5912
- .multiSelect=${((x=this.config)==null?void 0:x.multiSelect)??!0}
5913
- .maxSelections=${(b=this.config)==null?void 0:b.maxSelections}
6386
+ .multiSelect=${((L=this.config)==null?void 0:L.multiSelect)??!0}
6387
+ .maxSelections=${(P=this.config)==null?void 0:P.maxSelections}
5914
6388
  @selection-confirm=${this._handleSelectionConfirm}
5915
6389
  @selection-clear=${this._handleSelectionClear}
5916
6390
  @selection-deselect=${this._handleSelectionDeselect}
5917
6391
  @select-all=${this._handleSelectAll}
5918
6392
  ></ap-selection-bar>
5919
- `,d=this._isUploaderOpen?o.html`
6393
+ `,f=this._isUploaderOpen?o.html`
5920
6394
  <div class="uploader-overlay">
5921
6395
  ${this._isInline?o.nothing:o.html`
5922
6396
  <button class="uploader-close-btn" @click=${()=>this._handleCancel("close-button")} title="Close">
@@ -5927,24 +6401,24 @@
5927
6401
  </div>
5928
6402
  `:o.nothing;return this._isInline?e.isOpen?o.html`
5929
6403
  <div class="ap-inline">
5930
- ${this._isUploaderOpen?d:o.html`
5931
- <div class="inline-header">${a}</div>
5932
- <div class="inline-content">${n}</div>
5933
- <div class="inline-footer">${c}</div>
6404
+ ${this._isUploaderOpen?f:o.html`
6405
+ <div class="inline-header">${l}</div>
6406
+ <div class="inline-content">${h}</div>
6407
+ <div class="inline-footer">${u}</div>
5934
6408
  `}
5935
6409
  </div>
5936
6410
  `:o.nothing:o.html`
5937
6411
  <ap-modal
5938
6412
  ?open=${e.isOpen}
5939
- @ap-cancel=${k=>this._handleCancel(k.detail.reason)}
6413
+ @ap-cancel=${X=>this._handleCancel(X.detail.reason)}
5940
6414
  >
5941
- ${this._isUploaderOpen?d:o.html`
5942
- <div slot="header">${a}</div>
5943
- ${n}
5944
- <div slot="footer">${c}</div>
6415
+ ${this._isUploaderOpen?f:o.html`
6416
+ <div slot="header">${l}</div>
6417
+ ${h}
6418
+ <div slot="footer">${u}</div>
5945
6419
  `}
5946
6420
  </ap-modal>
5947
- `}_renderContent(e,s){var i,a,r;return e.activeTab==="assets"?!e.isLoading&&e.assets.length===0?o.html`
6421
+ `}_renderContent(e,s,i=[],a=!1){var r,n,l,d,h;return e.activeTab==="assets"?!e.isLoading&&e.assets.length===0?o.html`
5948
6422
  <div class="empty-state">
5949
6423
  <ap-icon name="search" .size=${48}></ap-icon>
5950
6424
  <div class="empty-title">No assets found</div>
@@ -5955,11 +6429,15 @@
5955
6429
  .assets=${e.assets}
5956
6430
  .folders=${[]}
5957
6431
  .selectedIds=${s}
6432
+ .selectedFolderIds=${i}
5958
6433
  .isLoading=${e.isLoading}
5959
- .multiSelect=${((i=this.config)==null?void 0:i.multiSelect)??!0}
6434
+ .multiSelect=${((r=this.config)==null?void 0:r.multiSelect)??!0}
6435
+ .folderSelectable=${a}
6436
+ .gridSize=${((n=this.config)==null?void 0:n.gridSize)??"normal"}
5960
6437
  @asset-select=${this._handleAssetSelect}
5961
6438
  @asset-preview=${this._handleAssetPreview}
5962
6439
  @asset-quick-select=${this._handleQuickSelect}
6440
+ @folder-select=${this._handleFolderSelect}
5963
6441
  ></ap-grid-view>
5964
6442
  <div id="sentinel"></div>
5965
6443
  `:o.html`
@@ -5967,13 +6445,16 @@
5967
6445
  .assets=${e.assets}
5968
6446
  .folders=${[]}
5969
6447
  .selectedIds=${s}
6448
+ .selectedFolderIds=${i}
5970
6449
  .isLoading=${e.isLoading}
5971
- .multiSelect=${((a=this.config)==null?void 0:a.multiSelect)??!0}
6450
+ .multiSelect=${((l=this.config)==null?void 0:l.multiSelect)??!0}
6451
+ .folderSelectable=${a}
5972
6452
  .totalCount=${e.totalCount}
5973
6453
  .isSelectingAll=${e.isSelectingAll}
5974
6454
  @asset-select=${this._handleAssetSelect}
5975
6455
  @asset-preview=${this._handleAssetPreview}
5976
6456
  @asset-quick-select=${this._handleQuickSelect}
6457
+ @folder-select=${this._handleFolderSelect}
5977
6458
  @select-all=${this._handleSelectAll}
5978
6459
  @selection-clear=${this._handleSelectionClear}
5979
6460
  ></ap-list-view>
@@ -5990,35 +6471,51 @@
5990
6471
  .folders=${e.folders}
5991
6472
  .folderPreviews=${e.folderPreviews}
5992
6473
  .selectedIds=${s}
6474
+ .selectedFolderIds=${i}
5993
6475
  .isLoading=${e.isLoading}
6476
+ .folderSelectable=${a}
6477
+ .gridSize=${((d=this.config)==null?void 0:d.gridSize)??"normal"}
5994
6478
  @asset-select=${this._handleAssetSelect}
5995
6479
  @asset-preview=${this._handleAssetPreview}
5996
6480
  @asset-quick-select=${this._handleQuickSelect}
5997
6481
  @folder-open=${this._handleFolderOpen}
6482
+ @folder-select=${this._handleFolderSelect}
5998
6483
  ></ap-grid-view>
5999
6484
  <div id="sentinel"></div>
6000
6485
  `:o.html`
6001
6486
  <ap-list-view
6002
6487
  .assets=${e.assets}
6003
6488
  .folders=${e.folders}
6489
+ .folderPreviews=${e.folderPreviews}
6004
6490
  .selectedIds=${s}
6491
+ .selectedFolderIds=${i}
6005
6492
  .isLoading=${e.isLoading}
6006
- .multiSelect=${((r=this.config)==null?void 0:r.multiSelect)??!0}
6493
+ .multiSelect=${((h=this.config)==null?void 0:h.multiSelect)??!0}
6494
+ .folderSelectable=${a}
6007
6495
  .totalCount=${e.totalCount}
6008
6496
  .isSelectingAll=${e.isSelectingAll}
6009
6497
  @asset-select=${this._handleAssetSelect}
6010
6498
  @asset-preview=${this._handleAssetPreview}
6011
6499
  @asset-quick-select=${this._handleQuickSelect}
6012
6500
  @folder-open=${this._handleFolderOpen}
6501
+ @folder-select=${this._handleFolderSelect}
6013
6502
  @select-all=${this._handleSelectAll}
6014
6503
  @selection-clear=${this._handleSelectionClear}
6015
6504
  ></ap-list-view>
6016
6505
  <div id="sentinel"></div>
6017
- `:o.nothing}};Nt.styles=[o.css`
6506
+ `:o.nothing}};Vt.styles=[o.css`
6018
6507
  :host {
6019
6508
  display: contents;
6020
6509
  font-family: var(--ap-font-family, system-ui, -apple-system, sans-serif);
6021
6510
  }
6511
+ :host([inline]) {
6512
+ display: block;
6513
+ overflow: hidden;
6514
+ width: 100%;
6515
+ min-width: 0;
6516
+ box-sizing: border-box;
6517
+ height: var(--ap-inline-height, 600px);
6518
+ }
6022
6519
  .content-area {
6023
6520
  position: relative;
6024
6521
  flex: 1;
@@ -6036,6 +6533,12 @@
6036
6533
  position: relative;
6037
6534
  z-index: 10;
6038
6535
  }
6536
+ .toolbar-filters-wrapper.sticky {
6537
+ position: sticky;
6538
+ top: 0;
6539
+ z-index: 20;
6540
+ background: var(--ap-background, oklch(1 0 0));
6541
+ }
6039
6542
  .empty-state {
6040
6543
  display: flex;
6041
6544
  flex-direction: column;
@@ -6067,7 +6570,7 @@
6067
6570
  .ap-inline {
6068
6571
  position: relative;
6069
6572
  width: 100%;
6070
- height: var(--ap-inline-height, 600px);
6573
+ height: 100%;
6071
6574
  overflow: hidden;
6072
6575
  display: flex;
6073
6576
  flex-direction: column;
@@ -6174,4 +6677,4 @@
6174
6677
  --sfx-up-border: transparent;
6175
6678
  --sfx-up-radius: 0;
6176
6679
  }
6177
- `];let Te=Nt;Rt([l.state()],Te.prototype,"_isDragOver");Rt([l.state()],Te.prototype,"_isUploaderOpen");Rt([l.property({type:Object})],Te.prototype,"config");exports.AssetPicker=Te;
6680
+ `];let $e=Vt;xt([c.state()],$e.prototype,"_isDragOver");xt([c.state()],$e.prototype,"_isUploaderOpen");xt([c.state()],$e.prototype,"_folderResolveOpen");xt([c.property({type:Object})],$e.prototype,"config");exports.AssetPicker=$e;