forked from bombastictranz/DuneQueryRepo
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4941-83611cd5e3751912.js.download
2 lines (2 loc) · 27.7 KB
/
4941-83611cd5e3751912.js.download
1
2
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4941],{5048:function(e,n,t){"use strict";function i(e){let{isCurrentlyPrivate:n,queryOwner:t,selectedOwner:i,remainingQuota:r}=e;return!!n&&t.id===i.id&&t.type===i.type||r>0}t.d(n,{V:function(){return i}})},27854:function(e,n,t){"use strict";t.d(n,{b:function(){return o}});var i=t(94184),r=t.n(i),s=t(67294),a=t(65297),l=t.n(a);let o=e=>{var n;let t=null!==(n=e.as)&&void 0!==n?n:"div",i=r()(l().cell,e.overflowVisible&&l().overflowVisible,e.scrollable&&l().scrollable,e.height&&l()["height-".concat(e.height)],e.span3&&l()["span3-".concat(e.span3)],e.span4&&l()["span4-".concat(e.span4)],e.span5&&l()["span5-".concat(e.span5)],e.span6&&l()["span6-".concat(e.span6)],e.span7&&l()["span7-".concat(e.span7)],e.span8&&l()["span8-".concat(e.span8)],e.span9&&l()["span9-".concat(e.span9)],e.className),a={className:i,id:e.id,style:e.style,"aria-labelledby":e["aria-labelledby"]};return s.createElement(t,a,e.children)}},65946:function(e,n,t){"use strict";t.d(n,{p:function(){return l}});var i=t(82729),r=t(84937),s=t(40802);function a(){let e=(0,i._)(["\n mutation MoveContent(\n $dashboardIds: [Int!]!\n $queryIds: [Int!]!\n $targetFolderId: String\n ) {\n moveContent(\n input: {\n dashboardIds: $dashboardIds\n queryIds: $queryIds\n targetFolderId: $targetFolderId\n }\n ) {\n ok\n }\n }\n"]);return a=function(){return e},e}function l(){let[e,n]=(0,r.OuL)();return[function(t,i){return new Promise(n.loading?()=>{}:n=>{e({context:{session:t},variables:{dashboardIds:i.selectedDashboards,queryIds:i.selectedQueries,targetFolderId:i.folderId}}).then(()=>{n()},e=>{e.message="Failed to move content to folder ".concat(i.folderId,": ")+e.message,s.Tb(e)})})},n]}(0,t(39137).Z)(a())},84060:function(e,n,t){"use strict";t.d(n,{X:function(){return l}});var i=t(85893),r=t(75485),s=t(4564),a=t(3602);function l(e){let n=(0,r.Q)(e.session,{owner:e.owner});return(0,i.jsx)(s.L9,{size:"M",label:"Create folder",isOpen:e.isCreateFolderModalOpen,onDismiss:()=>e.setIsCreateFolderModalOpen(!1),content:(0,i.jsx)(a.J,{onDismiss:()=>e.setIsCreateFolderModalOpen(!1),refetchFolders:async()=>{await n.refetch()},owner:e.owner})})}},3354:function(e,n,t){"use strict";t.d(n,{v:function(){return g}});var i=t(85893),r=t(91720),s=t.n(r),a=t(32613),l=t(75485),o=t(1801),d=t(89912),c=t(65946),u=t(57903),p=t(66465),_=t(51087),h=t(78080),v=t(54179),m=t(45466),x=t(57831);function g(e){var n,t;let{session:r,contentItem:{type:g,id:f,owner:j},isCreations:w,currentFolderName:y,refetch:b}=e,C=(0,l.Q)(r,{owner:j}),I=null===(n=C.data)||void 0===n?void 0:n.folders.folders,[z]=(0,c.p)(),{captureEvent:k}=(0,p.z$)(),N=function(e){var n;let t=(0,x.Ke)(),i=(0,m.gh)(t);return null===(n=i.find(n=>n.id===e))||void 0===n?void 0:n.serviceTier}(j.id);if(void 0===C||void 0===I)return null;let O=e=>{z(r,{selectedDashboards:"dashboard"===g?[f]:[],selectedQueries:"query"===g?[f]:[],folderId:null==e?void 0:e.id}).then(()=>{(0,u.Bh)({level:"success",title:"".concat("dashboard"===g?"Dashboard":"Query"," moved to ").concat(void 0!==e?e.name:"Creations")}),k("Content added to folder",{folder_id:void 0!==e?e.id:"Creations"}),b&&b()}).catch(e=>{(0,u.Bh)({level:"error",title:e.message})})},q="team"===j.type?null!==(t=null==N?void 0:N.maxFolders)&&void 0!==t?t:0:r.user.privateFields.serviceTier.maxFolders,M=I.length>=q;return(0,i.jsxs)(a.s_,{children:[(0,i.jsxs)(a.$0,{title:"Move to",maxHeight:"30.5rem",children:[!w&&(0,i.jsxs)(a.ys,{onClick:()=>O(),children:[(0,i.jsx)(o.C,{size:"M",variant:"filled",color:"neutral",iconOnly:!0,children:(0,i.jsx)(_.IconFolder,{})}),"Creations"]}),I.filter(e=>e.name!==y).map(e=>(0,i.jsxs)(a.ys,{onClick:()=>{O(e)},children:[(0,i.jsx)(o.C,{size:"M",variant:"filled",color:(0,d.SX)(e.color),iconOnly:!0,children:(0,d.q7)(e.icon)}),e.name]},e.id))]}),(0,i.jsx)(a.$0,{children:(0,i.jsx)(v.c,{position:"above-align-left",enabled:M,content:()=>(0,i.jsx)("div",{className:s().limitReachedTooltip,children:"You've reached the folder limit."}),children:(0,i.jsx)("div",{children:(0,i.jsxs)(a.ys,{disabled:M,onClick:()=>{e.setIsCreateFolderModalOpen(!0),e.close()},children:[(0,i.jsx)(h.IconPlus,{}),"New folder"]})})})})]})}},56283:function(e,n,t){"use strict";t.d(n,{V:function(){return o}});var i=t(85893),r=t(59999),s=t(80808),a=t(67294),l=t(45172);function o(e){return(0,a.useEffect)(()=>{e.isOpen&&l.Z.trackEvent("Query Settings Modal Opened",{button:e.trackedButtonLocationOnPage})},[e.isOpen,e.trackedButtonLocationOnPage]),(0,i.jsx)(r.Vq,{label:"Settings",size:"md",isOpen:e.isOpen,onDismiss:e.close,children:(0,i.jsx)(s.I,{onDismiss:e.close})})}},80808:function(e,n,t){"use strict";t.d(n,{I:function(){return P},g:function(){return V}});var i=t(85893),r=t(81879),s=t.n(r),a=t(23502),l=t(45850),o=t(67294),d=t(42120),c=t(57831),u=t(75642),p=t(41664),_=t.n(p),h=t(50642),v=t(10398),m=t(53947),x=t(61451),g=t(99134),f=t(57903),j=t(20326),w=t(5048),y=t(30990),b=t(54179),C=t(87312),I=t(40802),z=t(78718),k=t.n(z),N=t(4564),O=t(31544),q=t.n(O),M=t(42387);function T(e){let n=(0,c.qy)(),t=(0,d.dc)(),r=(0,d.OW)(),s=(0,d.Jm)(),[a,l]=(0,o.useState)(!1),u=(0,M.Q)();if(void 0===n||void 0===t||void 0===r)return null;let p=async()=>{if(!a){l(!0);try{await u({session:n,queryOwner:t,queryId:r}),null==s||s(),e.onArchive()}catch(e){if(e instanceof y.cA){let n=e.graphQLErrors[0].message;throw Error(n)}throw I.Tb("Failed to delete materialized view: ".concat(e),{extra:{deleter:k()(t,["id","type"]),queryId:r}}),Error("Failed to delete materialized view")}finally{l(!1)}}};return(0,i.jsx)(N.u_,{size:"M",label:"Archiving query with mat view",content:function(e){let{close:n}=e;return(0,i.jsxs)("div",{className:q().body,children:[(0,i.jsxs)("div",{className:q().header,children:[(0,i.jsx)("div",{className:q().titleRow,children:(0,i.jsx)("h2",{children:"Archiving this query will result in deletion of its materialized view"})}),(0,i.jsxs)("p",{className:q().description,children:["Deleting a materialized view will result in"," ",(0,i.jsx)("strong",{children:"breaking queries"})," that rely on it."]})]}),(0,i.jsxs)("div",{className:q().buttons,children:[(0,i.jsx)(x.z,{size:"M",theme:"tertiary",onClick:n,children:"Back"}),(0,i.jsx)(x.z,{size:"M",theme:"danger",loading:a,onClick:p,children:"Archive query and delete materialized view"})]})]})},trigger:n=>{let{onClick:t}=n;return o.cloneElement(e.children,{onClick:t})}})}var F=t(90844),S=t(20426),E=t(95404),Q=t(84937),D=t(27444),A=t(33219),L=t(45172);function P(e){var n,t,r,p,_;let[I,z]=(0,o.useState)(!1),[k,N]=(0,o.useState)(null),O=(0,c.Ke)(),q=(0,d.Jm)(),M=(0,d.f8)(),P=(0,d.QJ)(),[$,B]=(0,o.useState)((null==M?void 0:M.name)||""),[U,W]=(0,o.useState)((null==M?void 0:M.description)||""),[Z,X]=(0,o.useState)((0,a.X)(null==M?void 0:M.tags)),R=null!==(t=null==M?void 0:M.owner)&&void 0!==t?t:{type:"user",id:O.user.id,handle:O.user.name},[G,K]=(0,o.useState)(R),[Y,H]=(0,o.useState)(null!==(r=null==M?void 0:M.is_private)&&void 0!==r&&r),[J,ee]=(0,Q.tvN)({variables:{query:null!==(p=null==M?void 0:M.query)&&void 0!==p?p:""},context:{session:O},fetchPolicy:"no-cache",onCompleted:e=>{L.Z.trackEvent("Wand Query Description Generated",{description:e.wandQueryDescription}),W(e.wandQueryDescription)},onError:()=>{(0,f.Bh)({level:"error",title:"Error fetching query description"})}}),en=(0,j.G)(G),et=void 0!==M&&(0,w.V)({isCurrentlyPrivate:(null==M?void 0:M.is_private)||!1,queryOwner:M.owner,selectedOwner:G,remainingQuota:null!==(_=null===(n=en.data)||void 0===n?void 0:n.remainingQuota)&&void 0!==_?_:-1}),ei=M&&"id"in M,er=async e=>{z(!0),N(null);try{var n;return await (0,S._y)({...e,userId:"user"===e.owner.type?e.owner.id:null,teamId:"team"===e.owner.type?e.owner.id:null,tags:null!==(n=e.tags)&&void 0!==n?n:[],isPrivate:e.is_private,isArchived:e.is_archived,datasetId:e.dataset_id,isTemp:e.is_temp},O)}catch(e){throw N(e),e}finally{z(!1)}},es=()=>{if(!ei)return;let n={...M,code:M.query,is_archived:!(null==M?void 0:M.is_archived)};er(n).then(()=>{ea({type:"saveQuery"}),null==q||q(),e.onDismiss()})},ea=(0,d.L$)(),el=async n=>{if(null==n||n.preventDefault(),!ei)return;let t={...M,owner:{...M.owner,...G},name:$,description:U,is_private:Y,tags:(0,a.k)(Z)};try{await er(t),ea({type:"saveQuery"}),await (null==q?void 0:q()),e.onDismiss()}catch(e){e instanceof y.cA&&(0,u.b)(e.graphQLErrors[0])&&(H(!1),V(P))}};function eo(e){let{type:n}=e;return(0,i.jsx)(x.z,{theme:"primary",size:"M",loading:I,type:n,disabled:!$.trim(),children:"Save"})}return(0,o.useEffect)(()=>{(null==M?void 0:M.is_private)?H(et):H(!1)},[et,G]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("h1",{className:s().title,children:$}),(0,i.jsxs)(h.l,{size:"M",onSubmit:e=>el(e),children:[(0,i.jsx)(v.U,{size:"M",style:"contained",value:$,onChange:e=>B(e.target.value),label:"Title",placeholder:"Query title..."}),(0,i.jsxs)("div",{children:[(0,i.jsx)(A.K,{size:"L",style:"contained",value:U,onChange:e=>W(e.target.value),label:"Description",placeholder:"Query description..."}),!k&&(0,i.jsxs)("div",{className:s().description,children:[(0,i.jsxs)("div",{className:s().hint,children:[(0,i.jsx)(E.IconInformation,{}),(0,i.jsxs)("span",{children:["You can refer to parameters from your query with the `",(0,i.jsx)("code",{children:"{{parameter}}"}),"` syntax."]})]}),(0,i.jsx)("div",{children:(0,i.jsxs)(x.z,{theme:"primary",size:"M",type:"button",loading:ee.loading,onClick:()=>J(),children:["Write it for me ",(0,i.jsx)(D.IconMagicWand,{})]})})]})]}),(0,i.jsx)(v.U,{size:"M",style:"contained",value:Z,onChange:e=>X(e.target.value),label:"Tags",placeholder:"Tag 1, tag 2, tag-3",hint:"Separate tags with commas."}),P&&(0,i.jsx)(l.Z,{initialOwner:R,owner:G,setOwner:K}),(0,i.jsx)(b.c,{position:"below-align-left",content:()=>(0,i.jsx)(C.s,{resource:"query",hasAdminPermission:P}),enabled:!et,children:(0,i.jsx)(m.o,{label:"Privacy",checked:Y,onChange:e=>H(e.target.checked),disabled:!et,children:"Make private"})}),k instanceof Error&&!(0,u.b)(k)&&(0,i.jsxs)("div",{className:s().error,role:"alert",children:[(0,i.jsx)(g.IconWarning,{}),k.message]}),(0,i.jsxs)("div",{className:s().buttons,children:[(null==M?void 0:M.matview_id)?(0,i.jsx)(T,{onArchive:es,children:(0,i.jsx)(x.z,{theme:"danger",size:"M",disabled:I,type:"button",children:"Archive"})}):(0,i.jsx)(x.z,{theme:"danger",size:"M",disabled:I,onClick:es,type:"button",children:(null==M?void 0:M.is_archived)?"Unarchive":"Archive"}),(0,i.jsxs)("div",{children:[(0,i.jsx)(x.z,{theme:"tertiary",size:"M",disabled:I,onClick:e.onDismiss,type:"button",children:"Cancel"}),ei&&M.matview_id&&(R.type!==G.type||R.id!==G.id||R.handle!==G.handle)?(0,i.jsx)(F.t,{matViewId:M.matview_id,newOwner:G,onChangeOwner:el,children:(0,i.jsx)("div",{children:(0,i.jsx)(eo,{type:"button"})})}):(0,i.jsx)(eo,{type:"submit"})]})]})]})]})}function V(e){return e?(0,f.Bh)({level:"error",title:"You've reached the private query limit",actions:(0,i.jsx)(_(),{href:"/pricing",target:"_blank",children:"Upgrade plan"})}):(0,f.Bh)({level:"error",title:"Private query limit reached",description:"Please reach out to your team admin to manage it."})}},75642:function(e,n,t){"use strict";t.d(n,{b:function(){return r}});var i=t(14158);let r=e=>{if(e instanceof i._){var n;return(null===(n=e.extensions)||void 0===n?void 0:n.key)==="max_number_of_private_queries_reached"||e.message.includes("max_number_of_private_queries_reached")}return e.message.includes("max_number_of_private_queries_reached")||e.message.includes("User must be Pro to own a private resource.")||e.message.includes("Reached max number of private queries.")}},90844:function(e,n,t){"use strict";t.d(n,{t:function(){return x}});var i=t(85893),r=t(11865),s=t.n(r),a=t(67294),l=t(31544),o=t.n(l),d=t(61451),c=t(96740),u=t(42665),p=t(57831),_=t(58152),h=t(42387),v=t(3046),m=t(42120);function x(e){var n;let{matViewId:t,children:r,newOwner:l}=e,x=(0,m.f8)(),f=(0,m.Jm)(),j=(0,p.Ke)(),w=(0,_.E)(j,t),y=(0,h.Q)(),b=(0,v.Q)(),C=null==w?void 0:null===(n=w.sql_names)||void 0===n?void 0:n[0];if(void 0===t||!(x&&"id"in x)||null===w||void 0===C)return null;let{namespace:I,name:z}=function(e){let n=g.exec(e);if((null==n?void 0:n.groups)===void 0)throw Error("Could not parse mat view name: ".concat(e));let t=n.groups.namespace,i=n.groups.owner,r=n.groups.name;return{namespace:t,owner:i,name:r}}(C),k=async()=>{await y({queryId:x.id,queryOwner:x.owner,session:j}),await e.onChangeOwner(),await b({values:{name:z,cronString:w.schedule.cron_expression,performanceTier:w.schedule.performance,private:w.is_private},queryId:x.id,session:j,queryOwner:l}),await (null==f?void 0:f())};return(0,i.jsx)(c.u,{size:"M",label:"changing ownership query with mat view",content:function(e){let{close:n}=e;return(0,i.jsxs)("div",{className:o().body,children:[(0,i.jsxs)("div",{className:o().header,children:[(0,i.jsx)("div",{className:o().titleRow,children:(0,i.jsx)("h2",{children:"Changing ownership will break queries that rely on this query's materialized view"})}),(0,i.jsxs)("p",{className:o().description,children:["This materialized view's alias will change from current owner's handle to the new one:"," ",(0,i.jsxs)("strong",{children:[I,".",s()(l.handle),".",z]}),(0,i.jsx)("br",{}),(0,i.jsx)("br",{}),(0,i.jsx)(u.P,{level:"warning",title:"This change will affect other queries relying on this view.",description:(0,i.jsx)("p",{children:"You will need to update them manually after this change to reference the new owner."}),dismissable:!1})]})]}),(0,i.jsxs)("div",{className:o().buttons,children:[(0,i.jsx)(d.z,{size:"M",theme:"tertiary",onClick:n,children:"Back"}),(0,i.jsx)(d.z,{size:"M",theme:"danger",onClick:k,children:"Change owner"})]})]})},trigger:e=>{let{onClick:n}=e;return a.cloneElement(r,{onClick:n})}})}let g=RegExp("(?<namespace>\\w+)\\.(?<owner>\\w+)\\.result_(?<name>\\w+)")},3046:function(e,n,t){"use strict";t.d(n,{Q:function(){return d}});var i=t(82729),r=t(78718),s=t.n(r),a=t(39137),l=t(84937);function o(){let e=(0,i._)(["\n mutation CreateMatView($input: CreateMaterializedViewInput!) {\n createMaterializedView(input: $input) {\n matview_id: id\n query_id: queryId\n sql_names: sqlNames\n is_private: isPrivate\n execution_id: executionId\n schedule {\n id\n cron_expression: cronExpression\n performance\n next_execution_time: nextExecutionTime\n }\n }\n }\n"]);return o=function(){return e},e}let d=()=>{let[e,n]=(0,l.D5z)();return async t=>{let{session:i,values:r,queryOwner:a,queryId:l}=t;return n.loading?new Promise(()=>{}):await e({context:{session:i},variables:{input:{creator:s()(a,["id","type"]),queryId:l,name:"result_".concat(r.name),isPrivate:r.private,performance:r.performanceTier,cronExpression:r.cronString}}})}};(0,a.Z)(o())},42387:function(e,n,t){"use strict";t.d(n,{Q:function(){return d}});var i=t(82729),r=t(78718),s=t.n(r),a=t(39137),l=t(84937);function o(){let e=(0,i._)(["\n mutation DeleteMatView($input: DeleteMaterializedViewInput!) {\n deleteMaterializedView(input: $input) {\n ok\n }\n }\n"]);return o=function(){return e},e}let d=()=>{let[e,n]=(0,l.Ku2)();return async t=>{let{session:i,queryOwner:r,queryId:a}=t;return n.loading?new Promise(()=>{}):await e({context:{session:i},variables:{input:{deleter:s()(r,["id","type"]),queryId:a}}})}};(0,a.Z)(o())},58152:function(e,n,t){"use strict";t.d(n,{E:function(){return o}});var i=t(82729),r=t(61575),s=t(39137),a=t(84937);function l(){let e=(0,i._)(["\n query GetMatView($id: String!) {\n materializedView(id: $id) {\n id\n sql_names: sqlNames\n is_private: isPrivate\n last_execution_id : executionId\n table_size_bytes: tableSizeBytes\n schedule {\n id\n cron_expression: cronExpression\n performance\n next_execution_time: nextExecutionTime\n }\n }\n }\n"]);return l=function(){return e},e}let o=(e,n)=>{var t,i;let s=(0,r.Yd)(n),l=(0,a.g_H)({context:{session:e},skip:s,variables:{id:null!=n?n:""}});return null!==(i=null===(t=l.data)||void 0===t?void 0:t.materializedView)&&void 0!==i?i:null};(0,s.Z)(l())},20326:function(e,n,t){"use strict";t.d(n,{G:function(){return c}});var i=t(82729),r=t(57831),s=t(84937),a=t(39137),l=t(46367);function o(){let e=(0,i._)(["\n query GetUserPrivateQueries($userId: Int!) {\n user(id: $userId) {\n id\n privateFields {\n id\n privateQueriesCount\n }\n }\n }\n"]);return o=function(){return e},e}function d(){let e=(0,i._)(["\n query GetTeamPrivateQueries($teamId: Int!) {\n team(id: $teamId) {\n id\n memberFields {\n privateQueriesCount\n }\n serviceTier {\n id\n maxPrivateQueries\n }\n }\n }\n"]);return d=function(){return e},e}function c(e){var n,t,i,a,o,d;let c;let u=(0,r.Ke)(),p=(0,s.psL)({skip:!(0,l.n)(e)||"user"!==e.type,context:{session:u},fetchPolicy:"cache-and-network",variables:{userId:e.id}}),_=(0,s.NI6)({skip:!e||"team"!==e.type,context:{session:u},fetchPolicy:"cache-and-network",variables:{teamId:e.id}});if(!e)return{data:{remainingQuota:0},loading:!1};switch(e.type){case"team":{let e=null===(t=_.data)||void 0===t?void 0:null===(n=t.team.serviceTier)||void 0===n?void 0:n.maxPrivateQueries,r=null===(a=_.data)||void 0===a?void 0:null===(i=a.team.memberFields)||void 0===i?void 0:i.privateQueriesCount;c=null===e?1e3:void 0!==e&&void 0!==r?e-r:0;break}case"user":{let e=u.user.privateFields.serviceTier.maxPrivateQueries,n=null===(d=p.data)||void 0===d?void 0:null===(o=d.user.privateFields)||void 0===o?void 0:o.privateQueriesCount;c=null===e?1e3:void 0!==e&&void 0!==n?e-n:0}}let h="team"===e.type?_.loading:p.loading,v="team"===e.type?_.error:p.error;return{data:{remainingQuota:c},loading:h,error:v}}(0,a.Z)(o()),(0,a.Z)(d())},12111:function(e,n,t){"use strict";t.d(n,{V:function(){return P},B:function(){return V}});var i=t(85893),r=t(94184),s=t.n(r),a=t(61662),l=t.n(a),o=t(41664),d=t.n(o),c=t(30297),u=t(27854),p=t(82733),_=t(1801),h=t(5505),v=t(47730),m=t(26657),x=t(67294),g=t(60091),f=t.n(g),j=t(80949),w=t(90844),y=t(45186);let b=e=>{let[n,t]=(0,x.useState)(!1),{disabled:r,owner:a,onOwnerChange:l,eligibleOwners:o=[]}=e,c=o.reduce((e,n)=>{switch(n.type){case"user":return e.user=n,e;case"team":return e.teams.push(n),e}},{teams:[],user:void 0});if(r||!l||!c.user||o.length<=1)return(0,i.jsxs)(d(),{href:"/".concat(a.handle),children:["@",a.handle]});let u=e=>async()=>{t(!1),await l(e)},p=e=>e.id===a.id&&e.type===a.type;return(0,i.jsx)(y.r,{isOpen:n,setIsOpen:t,position:"below-align-left",content:()=>c.user&&(0,i.jsxs)("div",{className:f().body,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,i.jsx)("h3",{children:"Your account"}),(0,i.jsx)(C,{selected:p(c.user),owner:c.user,onClick:u(c.user),matViewId:e.matViewId}),c.teams.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("hr",{}),(0,i.jsx)("h3",{children:"Teams"}),(0,i.jsx)("div",{className:f().buttonGroup,children:c.teams.map(n=>(0,i.jsx)(C,{owner:n,selected:p(n),onClick:u(n),matViewId:e.matViewId},n.handle))})]})]}),children:(0,i.jsxs)("button",{className:s()(f().trigger,n&&f().active),children:[(0,i.jsxs)("span",{children:["@",a.handle]}),(0,i.jsx)(j.J,{icon:n?"caret-up-fill":"caret-down-fill"})]})})},C=e=>{let{selected:n,owner:t,onClick:r,matViewId:a}=e;function l(e){let{onClick:r}=e;return(0,i.jsxs)("button",{className:s()(n&&f().active),onClick:r,children:[(0,i.jsx)(c.q,{ownerId:t.id,handle:t.handle,src:t.profile_image_url,type:t.type,size:16}),(0,i.jsxs)("span",{children:["@",t.handle]}),n&&(0,i.jsx)(j.J,{icon:"simple-check"})]})}return void 0!==a?(0,i.jsx)(w.t,{matViewId:a,newOwner:t,onChangeOwner:r,children:(0,i.jsx)(l,{})}):(0,i.jsx)(l,{onClick:r})};var I=t(89912),z=t(73315),k=t.n(z),N=t(57831),O=t(3354),q=t(84060),M=t(18035);function T(e){let{content:{type:n,id:t,owner:r},result:s,refetch:a}=e,l=(0,N.qy)(),[o,c]=(0,x.useState)(!1);return l&&s&&void 0!==t?"Archived"===s.name?(0,i.jsxs)("div",{className:k().folder,children:[(0,i.jsx)(_.C,{size:"L",variant:"filled",color:(0,I.SX)(s.color),iconOnly:!0,children:(0,I.q7)(s.icon)}),(0,i.jsx)(d(),{href:(0,M.Y)(r)+"/folders/archived",children:s.name})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:k().folder,children:[(0,i.jsx)(y.f,{content:e=>{let{close:o}=e;return(0,i.jsx)(O.v,{session:l,currentFolderName:s.name,isCreations:"Creations"===s.name,contentItem:{type:n,id:t,owner:r},refetch:a,setIsCreateFolderModalOpen:c,close:o})},position:"below-align-left",closeOnClickOutside:!0,children:(0,i.jsx)("button",{children:(0,i.jsx)(_.C,{size:"L",variant:"filled",color:(0,I.SX)(s.color),iconOnly:!0,children:(0,I.q7)(s.icon)})})}),(0,i.jsx)(d(),{href:(0,M.Y)(r)+"".concat("Creations"===s.name?"/folders/creations":"/folders/".concat(s.name)),children:""===s.name?"Creations":s.name})]}),(0,i.jsx)(q.X,{session:l,isCreateFolderModalOpen:o,setIsCreateFolderModalOpen:c,owner:r})]}):null}var F=t(61085),S=t.n(F),E=t(71913),Q=t(56283);function D(e){let[n,t]=(0,x.useState)(!1),r=(0,N.kP)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("button",{className:S().title,onClick:()=>t(!0),children:[e.title,(0,i.jsx)(E.IconPencilLine,{})]}),r&&(0,i.jsx)(Q.V,{isOpen:n,close:()=>t(!1),session:r,trackedButtonLocationOnPage:"Query title"})]})}var A=t(42120);function L(e){var n;let t=(0,A.Lf)(),r=(0,A.ws)(),s=null!==(n=(0,A.hC)())&&void 0!==n&&n;return t&&r&&!s?(0,i.jsx)(D,{title:e.title}):(0,i.jsx)(i.Fragment,{children:e.title})}let P=e=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(m.L,{}),(0,i.jsx)(p.r,{as:"header",className:l().titleLarge,revealOnLoad:e.revealOnLoad,gaps:!0,children:(0,i.jsxs)(u.b,{children:[(0,i.jsxs)("h1",{id:e.id,children:[e.children,e.title]}),e.subtitle&&(0,i.jsx)("p",{children:e.subtitle})]})})]}),V=e=>{var n;let{owner:t}=e,r=(0,i.jsx)(d(),{href:"/".concat(t.handle),children:(0,i.jsx)(c.q,{ownerId:t.id,handle:t.handle,src:t.profile_image_url,type:t.type,size:25})}),a=e.private&&(0,i.jsx)("span",{className:l().private,children:" / Private"}),o=e.unsaved&&(0,i.jsx)("span",{className:l().unsaved,children:" / Unsaved"}),u=e.isArchived&&(0,i.jsx)("span",{children:"[Archived] "}),p=e.isTrending&&(0,i.jsx)(v.u,{position:"right-of-center",style:{whiteSpace:"unset",maxWidth:"22rem"},label:"Trending dashboards are refreshed periodically by Dune.",children:(0,i.jsxs)("span",{className:l().trendingBadge,children:[" ",(0,i.jsxs)(_.C,{variant:"filled",size:"M",color:"brand-orange",children:[(0,i.jsx)(h.IconClockHistory,{}),"Trending"]})]})}),m=e.folder&&(0,i.jsxs)(i.Fragment,{children:["/",(0,i.jsx)(T,{content:{type:e.folder.contentItem.type,id:e.folder.contentItem.id,owner:e.owner},result:e.folder.result,refetch:e.folder.refetchFolder})]}),x=(0,i.jsxs)(i.Fragment,{children:[u,"query"===e.resourceType?(0,i.jsx)(L,{title:e.title}):e.title,a,o,p]});return(0,i.jsxs)("header",{className:l().titleUser,children:[(0,i.jsx)("div",{className:l().avatar,children:r}),(0,i.jsxs)("div",{className:s()(l().title,e.isArchived?l().archived:void 0),children:[(0,i.jsxs)("div",{className:l().titleWrapper,children:[(0,i.jsxs)("h1",{children:[(0,i.jsx)(b,{onOwnerChange:e.onOwnerChange,disabled:!(null===(n=e.eligibleOwners)||void 0===n?void 0:n.length)||e.disableOwnerSelect,owner:e.owner,eligibleOwners:e.eligibleOwners,matViewId:e.matViewId}),m,(0,i.jsxs)(i.Fragment,{children:[" / ",x]})]}),e.action]}),e.caption&&(0,i.jsx)("div",{className:l().caption,children:e.caption})]}),e.tags&&(0,i.jsx)("div",{className:l().tags,children:e.tags}),e.children&&(0,i.jsx)("div",{className:l().actions,children:e.children})]})}},26657:function(e,n,t){"use strict";t.d(n,{L:function(){return o}});var i=t(85893),r=t(94184),s=t.n(r),a=t(12610),l=t.n(a);let o=e=>{let n=s()(l().spacer,e.at&&l()["at-".concat(e.at)],e.size&&l()[e.size]);return(0,i.jsx)("div",{className:n,"aria-hidden":!0})}},33219:function(e,n,t){"use strict";t.d(n,{K:function(){return c}});var i=t(85893),r=t(67294),s=t(94184),a=t.n(s),l=t(81642),o=t.n(l),d=t(99134);let c=(0,r.forwardRef)((e,n)=>{var t;let{size:s,style:l,placeholder:c,label:u,value:p,disabled:_,error:h,onChange:v,maxLength:m,className:x,hint:g,...f}=e,j=(0,r.useId)(),w=(0,r.useMemo)(()=>null!==(t=e.id)&&void 0!==t?t:j,[e.id]);return(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:o().topContent,children:[void 0!==u&&(0,i.jsx)("label",{htmlFor:w,className:o().label,children:u}),void 0!==m&&(0,i.jsxs)("div",{className:o().charCounter,children:[p.length,"/",m]})]}),(0,i.jsx)("div",{className:a()(o().textarea,o()["size-".concat(s)],o()["style-".concat(l)],void 0!==_&&o().disabled,void 0!==h&&o().textareaError,x),children:(0,i.jsx)("textarea",{id:w,placeholder:c,onChange:v,value:p,disabled:_,maxLength:m,ref:n,...f})}),void 0!==h&&(0,i.jsxs)("div",{className:o().error,role:"alert",children:[(0,i.jsx)(d.IconWarning,{}),h]}),void 0!==g&&(0,i.jsx)("div",{className:o().hint,"aria-describedby":"value",children:g})]})})},29570:function(e,n,t){"use strict";t.d(n,{U:function(){return i}});let i=(e,n)=>{let t=null!=e?e:"";return n?t.replace(/\{\{(.+?)\}\}/g,(e,t)=>{let i=n.find(e=>e.key===t);return i?!0===i.isMultiselect?String(i.values):i.value:e}):t}},65297:function(e){e.exports={cell:"cell_cell__mXiWb",scrollable:"cell_scrollable__lFh_I",overflowVisible:"cell_overflowVisible__OfidB","height-sm":"cell_height-sm__an7lM","span3-sm":"cell_span3-sm__pH4rE","span4-sm":"cell_span4-sm__mc8G2","span5-sm":"cell_span5-sm__5Dc2s","span6-sm":"cell_span6-sm__yIO6Y","span7-sm":"cell_span7-sm__zD7sZ","span8-sm":"cell_span8-sm__gUnbl","span9-sm":"cell_span9-sm__ZjtrG","span3-md":"cell_span3-md__UYoQD","span4-md":"cell_span4-md__k9IWp","span5-md":"cell_span5-md__7_D_X","span6-md":"cell_span6-md__7bduD","span7-md":"cell_span7-md__N9Aa_","span8-md":"cell_span8-md__Wb6Wf","span9-md":"cell_span9-md___z3HG","span3-lg":"cell_span3-lg__Z9ag3","span4-lg":"cell_span4-lg__Xu2rN","span5-lg":"cell_span5-lg__jHWnq","span6-lg":"cell_span6-lg___7TsH","span7-lg":"cell_span7-lg__WsH2O","span8-lg":"cell_span8-lg__8pZjp","span9-lg":"cell_span9-lg__CfZYC","span3-xl":"cell_span3-xl__LxcWj","span4-xl":"cell_span4-xl__9jZ0f","span5-xl":"cell_span5-xl__nhXoS","span6-xl":"cell_span6-xl__zvjFn","span7-xl":"cell_span7-xl__Dd_di","span8-xl":"cell_span8-xl__cMOQe","span9-xl":"cell_span9-xl__1qCDC"}},91720:function(e){e.exports={limitReachedTooltip:"MoveToFolder_limitReachedTooltip__F1lL_",upgradeLink:"MoveToFolder_upgradeLink__t8ALo"}},81879:function(e){e.exports={title:"EditSettingsDialogContent_title__InSAi",buttons:"EditSettingsDialogContent_buttons__epfQl",error:"EditSettingsDialogContent_error__XCCVI",description:"EditSettingsDialogContent_description__RbLx_",hint:"EditSettingsDialogContent_hint__Gw4Qm"}},73315:function(e){e.exports={folder:"BreadcrumbFolder_folder__glC9o"}},61085:function(e){e.exports={title:"EditableQueryTitle_title__Fu8yj"}},60091:function(e){e.exports={trigger:"SelectResourceOwner_trigger__e_66j",body:"SelectResourceOwner_body__3Kjvk",active:"SelectResourceOwner_active__Ezhlp",buttonGroup:"SelectResourceOwner_buttonGroup__DCXlD"}},61662:function(e){e.exports={titleLarge:"pagetitle_titleLarge__ukngc",titleUser:"pagetitle_titleUser__tUigb",avatar:"pagetitle_avatar__Uc3wz",title:"pagetitle_title__AmxKm",archived:"pagetitle_archived__Uk_KM",titleWrapper:"pagetitle_titleWrapper__Uruli",caption:"pagetitle_caption__a_FRk",tags:"pagetitle_tags__3IGcT",actions:"pagetitle_actions__ESc3D",private:"pagetitle_private__sBNWu",unsaved:"pagetitle_unsaved__Fp4Zm",trendingBadge:"pagetitle_trendingBadge__alXCA"}},12610:function(e){e.exports={spacer:"spacer_spacer__rHLjf",xs:"spacer_xs__tVaSO",sm:"spacer_sm__3KCxc",lg:"spacer_lg__XTXnI","at-sm":"spacer_at-sm__xulkb","at-md":"spacer_at-md__ftoNe","at-lg":"spacer_at-lg__kBWNu","at-xl":"spacer_at-xl__XZAS4"}},81642:function(e){e.exports={textarea:"TextArea_textarea__Nkffy","style-outlined":"TextArea_style-outlined__TMxqw",disabled:"TextArea_disabled__FCRPx",topContent:"TextArea_topContent__qVnb7",charCounter:"TextArea_charCounter__zbEgA",label:"TextArea_label__y21Ek","style-contained":"TextArea_style-contained__3iy_e",error:"TextArea_error__DoU9c",textareaError:"TextArea_textareaError__EZTjn","size-S":"TextArea_size-S__dx8uc","size-M":"TextArea_size-M__K_Mw4","size-L":"TextArea_size-L__aYSa7",hint:"TextArea_hint___Uxs2"}}}]);
//# sourceMappingURL=4941-83611cd5e3751912.js.map