"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[6607],{701862:(e,t,a)=>{a.r(t),a.d(t,{default:()=>xe});var n=a(211965),i=a(115926),o=a.n(i),s=a(667294),l=a(45697),r=a.n(l),d=a(287183),c=a(657011),h=a(229487),m=a(782607),p=a(964296),u=a(751995),g=a(61988),b=a(593185),f=a(431069),y=a(355786),Z=a(537208),C=a(844818),_=a(468135),v=a(104715),x=a(49238),w=a(835932),T=a(171262),S=a(679789),E=a(486057),D=a(73995),k=a(737921),I=a(838703),A=a(517982),B=a(138270),M=a(379069),K=a(979684),L=a(542878),P=a(100665),N=a(414114),X=a(313322),q=a(209870),U=a(409882);function $(e,t,a){return s.Children.map(e,(e=>{let n=e;return e&&e.type.name===t.name&&(n=(0,s.cloneElement)(e,a(e))),n&&n.props.children&&(n=(0,s.cloneElement)(n,{children:$(n.props.children,t,a)})),n}))}var z=a(358593),R=a(135944);const O=n.iv`
  .ant-form-item-control-input-content {
    display: flex;
    flex-direction: row;
  }
`;function H({fieldKey:e,value:t,label:a,description:n=null,control:i,onChange:o=(()=>{}),compact:l=!1,inline:r}){const d=(0,s.useCallback)((t=>{o(e,t)}),[o,e]),c=(0,s.cloneElement)(i,{value:t,onChange:d});return(0,R.BX)(x.xJ,{label:(0,R.BX)(x.lX,{className:"m-r-5",children:[a||e,l&&n&&(0,R.tZ)(z.u,{id:"field-descr",placement:"right",title:n,children:(0,R.tZ)("i",{className:"fa fa-info-circle m-l-5"})})]}),css:r&&O,children:[c,!l&&n&&(0,R.tZ)("div",{css:e=>({color:e.colors.grayscale.base,[r?"marginLeft":"marginTop"]:e.gridUnit}),children:n})]})}class F extends s.PureComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this)}onChange(e,t){return this.props.onChange({...this.props.item,[e]:t})}render(){const{title:e}=this.props;return(0,R.BX)(x.l0,{className:"CRUD",layout:"vertical",children:[e&&(0,R.tZ)("legend",{children:e}),$(this.props.children,H,(e=>({onChange:this.onChange,value:this.props.item[e.props.fieldKey],compact:this.props.compact})))]})}}var j;function Y(e){const t=e.map((e=>({...e,id:e.id||(0,p.x0)()}))),a={};return t.forEach((e=>{a[e.id]=e})),{collection:a,collectionArray:t}}F.defaultProps={compact:!1,title:null},function(e){e[e.Asc=1]="Asc",e[e.Desc=2]="Desc",e[e.Unsorted=0]="Unsorted"}(j||(j={}));const W=u.iK.div`
  ${({stickyHeader:e})=>e&&"\n      height: 350px;\n      overflow-y: auto;\n      overflow-x: auto;\n\n      .table {\n        min-width: 800px;\n      }\n      thead th {\n        background: #fff;\n        position: sticky;\n        top: 0;\n        z-index: 9;\n        min\n      }\n    "}
  ${({theme:e})=>`\n    th span {\n      vertical-align: ${-2*e.gridUnit}px;\n    }\n    .text-right {\n      text-align: right;\n    }\n    .empty-collection {\n      padding: ${2*e.gridUnit+2}px;\n    }\n    .tiny-cell {\n      width: ${e.gridUnit+1}px;\n    }\n    i.fa-caret-down,\n    i.fa-caret-up {\n      width: ${e.gridUnit+1}px;\n    }\n    td.expanded {\n      border-top: 0;\n      padding: 0;\n    }\n  `}
`,G=u.iK.div`
  text-align: right;
  ${({theme:e})=>`margin-bottom: ${2*e.gridUnit}px`}
`,V=u.iK.span`
  ${({theme:e})=>`\n    margin-top: ${3*e.gridUnit}px;\n    margin-left: ${3*e.gridUnit}px;\n  `}
`;class J extends s.PureComponent{constructor(e){super(e);const{collection:t,collectionArray:a}=Y(e.collection);this.state={expandedColumns:{},collection:t,collectionArray:a,sortColumn:"",sort:0},this.renderItem=this.renderItem.bind(this),this.onAddItem=this.onAddItem.bind(this),this.renderExpandableSection=this.renderExpandableSection.bind(this),this.getLabel=this.getLabel.bind(this),this.onFieldsetChange=this.onFieldsetChange.bind(this),this.renderTableBody=this.renderTableBody.bind(this),this.changeCollection=this.changeCollection.bind(this),this.sortColumn=this.sortColumn.bind(this),this.renderSortIcon=this.renderSortIcon.bind(this)}UNSAFE_componentWillReceiveProps(e){if(e.collection!==this.props.collection){const{collection:t,collectionArray:a}=Y(e.collection);this.setState({collection:t,collectionArray:a})}}onCellChange(e,t,a){this.changeCollection({...this.state.collection,[e]:{...this.state.collection[e],[t]:a}})}onAddItem(){if(this.props.itemGenerator){let e=this.props.itemGenerator();e.id||(e={...e,id:(0,p.x0)()}),this.changeCollection(this.state.collection,e)}}onFieldsetChange(e){this.changeCollection({...this.state.collection,[e.id]:e})}getLabel(e){const{columnLabels:t}=this.props;let a=null!=t&&t[e]?t[e]:e;return a.startsWith("__")&&(a=""),a}getTooltip(e){const{columnLabelTooltips:t}=this.props;return null==t?void 0:t[e]}changeCollection(e,t){if(this.setState({collection:e}),this.props.onChange){const a=this.state.collectionArray.map((t=>e[t.id])).filter((e=>void 0!==e));t&&a.unshift(t),this.props.onChange(a)}}deleteItem(e){const t={...this.state.collection};delete t[e],this.changeCollection(t)}effectiveTableColumns(){const{tableColumns:e,allowDeletes:t,expandFieldset:a}=this.props,n=t?e.concat(["__actions"]):e;return a?["__expand"].concat(n):n}toggleExpand(e){this.onCellChange(e,"__expanded",!1),this.setState((t=>({expandedColumns:{...t.expandedColumns,[e]:!t.expandedColumns[e]}})))}sortColumn(e,t=j.Unsorted){const{sortColumns:a}=this.props;return()=>{if(null!=a&&a.includes(e)){if(t===j.Unsorted){const{collection:e}=Y(this.props.collection),a=function(e){return Object.keys(e).map((t=>e[t]))}(e);return void this.setState({collectionArray:a,sortColumn:"",sort:t})}const a=[...this.state.collectionArray].sort(((t,a)=>{return n=t[e],i=a[e],"string"==typeof n?(n||" ").localeCompare(i):n-i;var n,i})),n=t===j.Asc?a:a.reverse();this.setState((a=>({...a,collectionArray:n,sortColumn:e,sort:t})))}}}renderSortIcon(e){return this.state.sortColumn===e&&this.state.sort===j.Asc?(0,R.tZ)(X.Z.SortAsc,{onClick:this.sortColumn(e,2)}):this.state.sortColumn===e&&this.state.sort===j.Desc?(0,R.tZ)(X.Z.SortDesc,{onClick:this.sortColumn(e,0)}):(0,R.tZ)(X.Z.Sort,{onClick:this.sortColumn(e,1)})}renderTH(e,t){const a=this.getTooltip(e);return(0,R.BX)("th",{className:"no-wrap",children:[this.getLabel(e),a&&(0,R.BX)(R.HY,{children:[" ",(0,R.tZ)(U.V,{label:(0,g.t)("description"),tooltip:a})]}),(null==t?void 0:t.includes(e))&&this.renderSortIcon(e)]},e)}renderHeaderRow(){const e=this.effectiveTableColumns(),{allowDeletes:t,expandFieldset:a,extraButtons:n,sortColumns:i}=this.props;return(0,R.tZ)("thead",{children:(0,R.BX)("tr",{children:[a&&(0,R.tZ)("th",{"aria-label":"Expand",className:"tiny-cell"}),e.map((e=>this.renderTH(e,i))),n,t&&(0,R.tZ)("th",{"aria-label":"Delete",className:"tiny-cell"},"delete-item")]})})}renderExpandableSection(e){return $(this.props.expandFieldset,F,(()=>({item:e,onChange:this.onFieldsetChange})))}getCellProps(e,t){var a;const n=null==(a=this.props.itemCellProps)?void 0:a[t],i=e[t];return n?n(i,this.getLabel(t),e):{}}renderCell(e,t){var a;const n=null==(a=this.props.itemRenderers)?void 0:a[t],i=e[t],o=this.onCellChange.bind(this,e.id,t);return n?n(i,o,this.getLabel(t),e):i}renderItem(e){const{allowAddItem:t,allowDeletes:a,expandFieldset:i,tableColumns:o}=this.props,s=!!this.state.expandedColumns[e.id]||e.__expanded;let l=[];i&&l.push((0,R.tZ)("td",{className:"expand",children:(0,R.tZ)("i",{role:"button","aria-label":"Toggle expand",tabIndex:0,className:`fa fa-caret-${s?"down":"right"} text-primary pointer`,onClick:this.toggleExpand.bind(this,e.id)})},"__expand")),l=l.concat(o.map((t=>(0,n.az)("td",{...this.getCellProps(e,t),key:t},this.renderCell(e,t))))),t&&l.push((0,R.tZ)("td",{},"add")),a&&l.push((0,R.tZ)("td",{className:"text-primary",children:(0,R.tZ)(X.Z.Trash,{"aria-label":"Delete item",className:"pointer",role:"button",tabIndex:0,onClick:this.deleteItem.bind(this,e.id)})},"__actions"));const r=[(0,n.az)("tr",{className:"row",key:e.id},l)];return s&&r.push((0,R.tZ)("tr",{className:"exp",children:(0,R.tZ)("td",{colSpan:this.effectiveTableColumns().length,className:"expanded",children:(0,R.tZ)("div",{children:this.renderExpandableSection(e)})})},`exp__${e.id}`)),r}renderEmptyCell(){return(0,R.tZ)("tr",{children:(0,R.tZ)("td",{className:"empty-collection",children:this.props.emptyMessage})})}renderTableBody(){const e=this.state.collectionArray,t=e.length?e.map((e=>this.renderItem(e))):this.renderEmptyCell();return(0,R.tZ)("tbody",{children:t})}render(){return(0,R.BX)(R.HY,{children:[(0,R.tZ)(G,{children:this.props.allowAddItem&&(0,R.tZ)(V,{children:(0,R.BX)(w.Z,{buttonSize:"small",buttonStyle:"tertiary",onClick:this.onAddItem,children:[(0,R.tZ)("i",{className:"fa fa-plus"})," ",(0,g.t)("Add item")]})})}),(0,R.tZ)(W,{className:"CRUD",stickyHeader:this.props.stickyHeader,children:(0,R.BX)("table",{className:"table",children:[this.renderHeaderRow(),this.renderTableBody()]})})]})}}const Q=u.iK.div`
  .change-warning {
    margin: 16px 10px 0;
    color: ${({theme:e})=>e.colors.warning.base};
  }

  .change-warning .bold {
    font-weight: ${({theme:e})=>e.typography.weights.bold};
  }

  .form-group.has-feedback > .help-block {
    margin-top: 8px;
  }

  .form-group.form-group-md {
    margin-bottom: 8px;
  }
`,ee=u.iK.div`
  align-items: center;
  display: flex;

  svg {
    margin-right: ${({theme:e})=>e.gridUnit}px;
  }
`,te=(0,u.iK)(T.ZP)`
  overflow: visible;
  .ant-tabs-content-holder {
    overflow: visible;
  }
`,ae=(0,u.iK)(m.Z)`
  .antd5-badge-count {
    line-height: ${({theme:e})=>4*e.gridUnit}px;
    height: ${({theme:e})=>4*e.gridUnit}px;
    margin-left: ${({theme:e})=>e.gridUnit}px;
  }
`,ne=u.iK.div`
  font-size: ${({theme:e})=>e.typography.sizes.s}px;
  display: flex;
  align-items: center;
  a {
    padding: 0 10px;
  }
`,ie=u.iK.div`
  text-align: right;
  ${({theme:e})=>`margin-bottom: ${2*e.gridUnit}px`}
`,oe=u.iK.div`
  display: flex;
  align-items: center;
  span {
    margin-right: ${({theme:e})=>e.gridUnit}px;
  }
`,se=u.iK.div`
  .table > tbody > tr > td {
    vertical-align: middle;
  }

  .ant-tag {
    margin-top: ${({theme:e})=>e.gridUnit}px;
  }
`,le=u.iK.span`
  ${({theme:e})=>`\n    margin-top: ${3*e.gridUnit}px;\n    margin-left: ${3*e.gridUnit}px;\n  `}
`,re=(e,t)=>(0,R.tZ)(M.Z,{value:e,onChange:t}),de=[{value:"STRING",label:(0,g.t)("STRING")},{value:"NUMERIC",label:(0,g.t)("NUMERIC")},{value:"DATETIME",label:(0,g.t)("DATETIME")},{value:"BOOLEAN",label:(0,g.t)("BOOLEAN")}],ce=[{key:"physical",label:(0,g.t)("Physical (table or view)")},{key:"virtual",label:(0,g.t)("Virtual (SQL)")}],he={};ce.forEach((e=>{he[e.key]=e}));var me={name:"s5xdrg",styles:"display:flex;align-items:center"};function pe({title:e,collection:t}){return(0,R.BX)("div",{css:me,children:[e," ",(0,R.tZ)(ae,{count:t?t.length:0,showZero:!0})]})}function ue({columns:e,datasource:t,onColumnsChange:a,onDatasourceChange:n,editableColumnName:i,showExpression:o,allowAddItem:s,allowEditDataType:l,itemGenerator:r,columnLabelTooltips:c}){return(0,R.tZ)(J,{tableColumns:(0,b.cr)(b.TT.EnableAdvancedDataTypes)?["column_name","advanced_data_type","type","is_dttm","main_dttm_col","filterable","groupby"]:["column_name","type","is_dttm","main_dttm_col","filterable","groupby"],sortColumns:(0,b.cr)(b.TT.EnableAdvancedDataTypes)?["column_name","advanced_data_type","type","is_dttm","main_dttm_col","filterable","groupby"]:["column_name","type","is_dttm","main_dttm_col","filterable","groupby"],allowDeletes:!0,allowAddItem:s,itemGenerator:r,collection:e,columnLabelTooltips:c,stickyHeader:!0,expandFieldset:(0,R.tZ)(be,{children:(0,R.BX)(F,{compact:!0,children:[o&&(0,R.tZ)(H,{fieldKey:"expression",label:(0,g.t)("SQL expression"),control:(0,R.tZ)(L.Z,{language:"markdown",offerEditInModal:!1,resize:"vertical"})}),(0,R.tZ)(H,{fieldKey:"verbose_name",label:(0,g.t)("Label"),control:(0,R.tZ)(K.Z,{controlId:"verbose_name",placeholder:(0,g.t)("Label")})}),(0,R.tZ)(H,{fieldKey:"description",label:(0,g.t)("Description"),control:(0,R.tZ)(K.Z,{controlId:"description",placeholder:(0,g.t)("Description")})}),l&&(0,R.tZ)(H,{fieldKey:"type",label:(0,g.t)("Data type"),control:(0,R.tZ)(v.Ph,{ariaLabel:(0,g.t)("Data type"),options:de,name:"type",allowNewOptions:!0,allowClear:!0})}),(0,b.cr)(b.TT.EnableAdvancedDataTypes)?(0,R.tZ)(H,{fieldKey:"advanced_data_type",label:(0,g.t)("Advanced data type"),control:(0,R.tZ)(K.Z,{controlId:"advanced_data_type",placeholder:(0,g.t)("Advanced Data type")})}):(0,R.tZ)(R.HY,{}),(0,R.tZ)(H,{fieldKey:"python_date_format",label:(0,g.t)("Datetime format"),description:(0,R.BX)("div",{children:[(0,g.t)("The pattern of timestamp format. For strings use "),(0,R.tZ)("a",{href:"https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior",children:(0,g.t)("Python datetime string pattern")}),(0,g.t)(" expression which needs to adhere to the "),(0,R.tZ)("a",{href:"https://en.wikipedia.org/wiki/ISO_8601",children:(0,g.t)("ISO 8601")}),(0,g.t)(" standard to ensure that the lexicographical ordering\n                      coincides with the chronological ordering. If the\n                      timestamp format does not adhere to the ISO 8601 standard\n                      you will need to define an expression and type for\n                      transforming the string into a date or timestamp. Note\n                      currently time zones are not supported. If time is stored\n                      in epoch format, put `epoch_s` or `epoch_ms`. If no pattern\n                      is specified we fall back to using the optional defaults on a per\n                      database/column name level via the extra parameter.")]}),control:(0,R.tZ)(K.Z,{controlId:"python_date_format",placeholder:"%Y-%m-%d"})}),(0,R.tZ)(H,{fieldKey:"certified_by",label:(0,g.t)("Certified By"),description:(0,g.t)("Person or group that has certified this metric"),control:(0,R.tZ)(K.Z,{controlId:"certified",placeholder:(0,g.t)("Certified by")})}),(0,R.tZ)(H,{fieldKey:"certification_details",label:(0,g.t)("Certification details"),description:(0,g.t)("Details of the certification"),control:(0,R.tZ)(K.Z,{controlId:"certificationDetails",placeholder:(0,g.t)("Certification details")})})]})}),columnLabels:(0,b.cr)(b.TT.EnableAdvancedDataTypes)?{column_name:(0,g.t)("Column"),advanced_data_type:(0,g.t)("Advanced data type"),type:(0,g.t)("Data type"),groupby:(0,g.t)("Is dimension"),is_dttm:(0,g.t)("Is temporal"),main_dttm_col:(0,g.t)("Default datetime"),filterable:(0,g.t)("Is filterable")}:{column_name:(0,g.t)("Column"),type:(0,g.t)("Data type"),groupby:(0,g.t)("Is dimension"),is_dttm:(0,g.t)("Is temporal"),main_dttm_col:(0,g.t)("Default datetime"),filterable:(0,g.t)("Is filterable")},onChange:a,itemRenderers:(0,b.cr)(b.TT.EnableAdvancedDataTypes)?{column_name:(e,t,a,n)=>i?(0,R.BX)(oe,{children:[n.is_certified&&(0,R.tZ)(S.Z,{certifiedBy:n.certified_by,details:n.certification_details}),(0,R.tZ)(B.Z,{canEdit:!0,title:e,onSaveTitle:t})]}):(0,R.BX)(oe,{children:[n.is_certified&&(0,R.tZ)(S.Z,{certifiedBy:n.certified_by,details:n.certification_details}),e]}),main_dttm_col:(a,i,o,s)=>{const l=t.main_dttm_col===s.column_name,r=!e.find((e=>e.column_name===s.column_name)).is_dttm;return(0,R.tZ)(d.Y,{checked:l,disabled:r,onChange:()=>n({...t,main_dttm_col:s.column_name})})},type:e=>e?(0,R.tZ)(k.Z,{children:e}):null,advanced_data_type:e=>(0,R.tZ)(k.Z,{onChange:a,children:e}),is_dttm:re,filterable:re,groupby:re}:{column_name:(e,t,a,n)=>i?(0,R.BX)(oe,{children:[n.is_certified&&(0,R.tZ)(S.Z,{certifiedBy:n.certified_by,details:n.certification_details}),(0,R.tZ)(K.Z,{value:e,onChange:t})]}):(0,R.BX)(oe,{children:[n.is_certified&&(0,R.tZ)(S.Z,{certifiedBy:n.certified_by,details:n.certification_details}),e]}),main_dttm_col:(a,i,o,s)=>{const l=t.main_dttm_col===s.column_name,r=!e.find((e=>e.column_name===s.column_name)).is_dttm;return(0,R.tZ)(d.Y,{checked:l,disabled:r,onChange:()=>n({...t,main_dttm_col:s.column_name})})},type:e=>e?(0,R.tZ)(k.Z,{children:e}):null,is_dttm:re,filterable:re,groupby:re}})}function ge({label:e,formElement:t}){return(0,R.BX)("div",{children:[(0,R.tZ)("div",{children:(0,R.tZ)("strong",{children:e})}),(0,R.tZ)("div",{children:t})]})}function be({children:e}){return(0,R.tZ)(c.Z,{padded:!0,children:e})}pe.propTypes={title:r().string,collection:r().array},ue.propTypes={columns:r().array.isRequired,datasource:r().object.isRequired,onColumnsChange:r().func.isRequired,onDatasourceChange:r().func.isRequired,editableColumnName:r().bool,showExpression:r().bool,allowAddItem:r().bool,allowEditDataType:r().bool,itemGenerator:r().func},ue.defaultProps={editableColumnName:!1,showExpression:!1,allowAddItem:!1,allowEditDataType:!1,itemGenerator:()=>({column_name:(0,g.t)("<new column>"),filterable:!0,groupby:!0})},ge.propTypes={label:r().string,formElement:r().node},be.propTypes={children:r().node};const fe={datasource:r().object.isRequired,onChange:r().func,addSuccessToast:r().func.isRequired,addDangerToast:r().func.isRequired,setIsEditing:r().func};function ye({datasource:e,onChange:t}){const a=(0,s.useCallback)(((e="",t,a)=>{const n=o().encode({filter:e,page:t,page_size:a});return f.Z.get({endpoint:`/api/v1/dataset/related/owners?q=${n}`}).then((e=>({data:e.json.result.filter((e=>e.extra.active)).map((e=>({value:e.value,label:e.text}))),totalCount:e.json.count})))}),[]);return(0,R.tZ)(v.qb,{ariaLabel:(0,g.t)("Select owners"),mode:"multiple",name:"owners",value:e.owners,options:a,onChange:t,header:(0,R.tZ)(x.lX,{children:(0,g.t)("Owners")}),allowClear:!0})}var Ze={name:"hkh81z",styles:"margin-top:8px"},Ce={name:"hkh81z",styles:"margin-top:8px"};class _e extends s.PureComponent{constructor(e){var t;super(e),this.state={datasource:{...e.datasource,owners:e.datasource.owners.map((e=>({value:e.value||e.id,label:e.label||`${e.first_name} ${e.last_name}`}))),metrics:null==(t=e.datasource.metrics)?void 0:t.map((e=>{const{certified_by:t,certification_details:a}=e,{certification:{details:n,certified_by:i}={},warning_markdown:o}=JSON.parse(e.extra||"{}")||{};return{...e,certification_details:a||n,warning_markdown:o||"",certified_by:i||t}}))},errors:[],isSqla:"table"===e.datasource.datasource_type||"table"===e.datasource.type,isEditMode:!1,databaseColumns:e.datasource.columns.filter((e=>!e.expression)),calculatedColumns:e.datasource.columns.filter((e=>!!e.expression)),metadataLoading:!1,activeTabKey:0,datasourceType:e.datasource.sql?he.virtual.key:he.physical.key},this.onChange=this.onChange.bind(this),this.onChangeEditMode=this.onChangeEditMode.bind(this),this.onDatasourcePropChange=this.onDatasourcePropChange.bind(this),this.onDatasourceChange=this.onDatasourceChange.bind(this),this.tableChangeAndSyncMetadata=this.tableChangeAndSyncMetadata.bind(this),this.syncMetadata=this.syncMetadata.bind(this),this.setColumns=this.setColumns.bind(this),this.validateAndChange=this.validateAndChange.bind(this),this.handleTabSelect=this.handleTabSelect.bind(this),this.currencies=(0,y.Z)(e.currencies).map((e=>({value:e,label:`${(0,Z.j)({symbol:e})} (${e})`})))}onChange(){const{datasourceType:e,datasource:t}=this.state,a=e===he.physical.key?"":t.sql,n={...this.state.datasource,sql:a,columns:[...this.state.databaseColumns,...this.state.calculatedColumns]};this.props.onChange(n,this.state.errors)}onChangeEditMode(){this.props.setIsEditing(!this.state.isEditMode),this.setState((e=>({isEditMode:!e.isEditMode})))}onDatasourceChange(e,t=this.validateAndChange){this.setState({datasource:e},t)}onDatasourcePropChange(e,t){if(void 0===t)return;const a={...this.state.datasource,[e]:t};this.setState((a=>({datasource:{...a.datasource,[e]:t}})),"table_name"===e?this.onDatasourceChange(a,this.tableChangeAndSyncMetadata):this.onDatasourceChange(a,this.validateAndChange))}onDatasourceTypeChange(e){this.setState({datasourceType:e})}setColumns(e){this.setState(e,this.validateAndChange)}validateAndChange(){this.validate(this.onChange)}tableChangeAndSyncMetadata(){this.validate((()=>{this.syncMetadata(),this.onChange()}))}updateColumns(e){const{databaseColumns:t}=this.state,a=e.map((e=>e.column_name)),n=t.reduce(((e,t)=>({...e,[t.column_name]:t})),{}),i=[],o={added:[],modified:[],removed:t.map((e=>e.column_name)).filter((e=>!a.includes(e)))};return e.forEach((e=>{const t=n[e.column_name];t?t.type!==e.type||!t.is_dttm&&e.is_dttm?(i.push({...t,type:e.type,is_dttm:t.is_dttm||e.is_dttm}),o.modified.push(e.column_name)):i.push(t):(i.push({id:(0,p.x0)(),column_name:e.column_name,type:e.type,groupby:!0,filterable:!0,is_dttm:e.is_dttm}),o.added.push(e.column_name))})),(o.added.length||o.modified.length||o.removed.length)&&this.setColumns({databaseColumns:i}),o}syncMetadata(){const{datasource:e}=this.state,t={datasource_type:e.type||e.datasource_type,database_name:e.database.database_name||e.database.name,catalog_name:e.catalog,schema_name:e.schema,table_name:e.table_name,normalize_columns:e.normalize_columns,always_filter_main_dttm:e.always_filter_main_dttm};Object.entries(t).forEach((([e,a])=>{void 0===a&&(t[e]=null)}));const a=`/datasource/external_metadata_by_name/?q=${o().encode_uri(t)}`;this.setState({metadataLoading:!0}),f.Z.get({endpoint:a}).then((({json:e})=>{const t=this.updateColumns(e);t.modified.length&&this.props.addSuccessToast((0,g.t)("Modified columns: %s",t.modified.join(", "))),t.removed.length&&this.props.addSuccessToast((0,g.t)("Removed columns: %s",t.removed.join(", "))),t.added.length&&this.props.addSuccessToast((0,g.t)("New columns added: %s",t.added.join(", "))),this.props.addSuccessToast((0,g.t)("Metadata has been synced")),this.setState({metadataLoading:!1})})).catch((e=>(0,C.O$)(e).then((({error:e,statusText:t})=>{this.props.addDangerToast(e||t||(0,g.t)("An error has occurred")),this.setState({metadataLoading:!1})}))))}findDuplicates(e,t){const a={},n=[];return e.forEach((e=>{const i=t(e);i in a?n.push(i):a[i]=null})),n}validate(e){let t,a=[];const{datasource:n}=this.state;t=this.findDuplicates(n.columns,(e=>e.column_name)),a=a.concat(t.map((e=>(0,g.t)("Column name [%s] is duplicated",e)))),t=this.findDuplicates(n.metrics,(e=>e.metric_name)),a=a.concat(t.map((e=>(0,g.t)("Metric name [%s] is duplicated",e))));const i=this.state.calculatedColumns.filter((e=>!e.expression&&!e.json));a=a.concat(i.map((e=>(0,g.t)("Calculated column [%s] requires an expression",e.column_name))));try{var o;null==(o=this.state.datasource.metrics)||o.forEach((e=>{var t;return(null==(t=e.currency)?void 0:t.symbol)&&new Intl.NumberFormat("en-US",{style:"currency",currency:e.currency.symbol})}))}catch{a=a.concat([(0,g.t)("Invalid currency code in saved metrics")])}this.setState({errors:a},e)}handleTabSelect(e){this.setState({activeTabKey:e})}sortMetrics(e){return e.sort((({id:e},{id:t})=>t-e))}renderSettingsFieldset(){const{datasource:e}=this.state;return(0,R.BX)(F,{title:(0,g.t)("Basic"),item:e,onChange:this.onDatasourceChange,children:[(0,R.tZ)(H,{fieldKey:"description",label:(0,g.t)("Description"),control:(0,R.tZ)(L.Z,{language:"markdown",offerEditInModal:!1,resize:"vertical"})}),(0,R.tZ)(H,{fieldKey:"default_endpoint",label:(0,g.t)("Default URL"),description:(0,g.t)("Default URL to redirect to when accessing from the dataset list page"),control:(0,R.tZ)(K.Z,{controlId:"default_endpoint"})}),(0,R.tZ)(H,{inline:!0,fieldKey:"filter_select_enabled",label:(0,g.t)("Autocomplete filters"),description:(0,g.t)("Whether to populate autocomplete filters options"),control:(0,R.tZ)(M.Z,{})}),this.state.isSqla&&(0,R.tZ)(H,{fieldKey:"fetch_values_predicate",label:(0,g.t)("Autocomplete query predicate"),description:(0,g.t)('When using "Autocomplete filters", this can be used to improve performance of the query fetching the values. Use this option to apply a predicate (WHERE clause) to the query selecting the distinct values from the table. Typically the intent would be to limit the scan by applying a relative time filter on a partitioned or indexed time-related field.'),control:(0,R.tZ)(L.Z,{language:"sql",controlId:"fetch_values_predicate",minLines:5,resize:"vertical"})}),this.state.isSqla&&(0,R.tZ)(H,{fieldKey:"extra",label:(0,g.t)("Extra"),description:(0,g.t)('Extra data to specify table metadata. Currently supports metadata of the format: `{ "certification": { "certified_by": "Data Platform Team", "details": "This table is the source of truth." }, "warning_markdown": "This is a warning." }`.'),control:(0,R.tZ)(L.Z,{controlId:"extra",language:"json",offerEditInModal:!1,resize:"vertical"})}),(0,R.tZ)(ye,{datasource:e,onChange:t=>{this.onDatasourceChange({...e,owners:t})}})]})}renderAdvancedFieldset(){const{datasource:e}=this.state;return(0,R.BX)(F,{title:(0,g.t)("Advanced"),item:e,onChange:this.onDatasourceChange,children:[(0,R.tZ)(H,{fieldKey:"cache_timeout",label:(0,g.t)("Cache timeout"),description:(0,g.t)("The duration of time in seconds before the cache is invalidated. Set to -1 to bypass the cache."),control:(0,R.tZ)(K.Z,{controlId:"cache_timeout"})}),(0,R.tZ)(H,{fieldKey:"offset",label:(0,g.t)("Hours offset"),control:(0,R.tZ)(K.Z,{controlId:"offset"}),description:(0,g.t)("The number of hours, negative or positive, to shift the time column. This can be used to move UTC time to local time.")}),this.state.isSqla&&(0,R.tZ)(H,{fieldKey:"template_params",label:(0,g.t)("Template parameters"),description:(0,g.t)("A set of parameters that become available in the query using Jinja templating syntax"),control:(0,R.tZ)(K.Z,{controlId:"template_params"})}),(0,R.tZ)(H,{inline:!0,fieldKey:"normalize_columns",label:(0,g.t)("Normalize column names"),description:(0,g.t)("Allow column names to be changed to case insensitive format, if supported (e.g. Oracle, Snowflake)."),control:(0,R.tZ)(M.Z,{controlId:"normalize_columns"})}),(0,R.tZ)(H,{inline:!0,fieldKey:"always_filter_main_dttm",label:(0,g.t)("Always filter main datetime column"),description:(0,g.t)("When the secondary temporal columns are filtered, apply the same filter to the main datetime column."),control:(0,R.tZ)(M.Z,{controlId:"always_filter_main_dttm"})})]})}renderSpatialTab(){const{datasource:e}=this.state,{spatials:t,all_cols:a}=e;return(0,R.tZ)(T.ZP.TabPane,{tab:(0,R.tZ)(pe,{collection:t,title:(0,g.t)("Spatial")}),children:(0,R.tZ)(J,{tableColumns:["name","config"],onChange:this.onDatasourcePropChange.bind(this,"spatials"),itemGenerator:()=>({name:(0,g.t)("<new spatial>"),type:(0,g.t)("<no type>"),config:null}),collection:t,allowDeletes:!0,itemRenderers:{name:(e,t)=>(0,R.tZ)(B.Z,{canEdit:!0,title:e,onSaveTitle:t}),config:(e,t)=>(0,R.tZ)(P.Z,{value:e,onChange:t,choices:a})}})},4)}renderSourceFieldset(e){var t,a,i;const{datasource:o}=this.state;return(0,R.BX)("div",{children:[(0,R.BX)(ne,{children:[(0,R.tZ)("span",{role:"button",tabIndex:0,onClick:this.onChangeEditMode,children:this.state.isEditMode?(0,R.tZ)(X.Z.LockUnlocked,{iconColor:e.colors.grayscale.base}):(0,R.tZ)(X.Z.LockLocked,{iconColor:e.colors.grayscale.base})}),!this.state.isEditMode&&(0,R.tZ)("div",{children:(0,g.t)("Click the lock to make changes.")}),this.state.isEditMode&&(0,R.tZ)("div",{children:(0,g.t)("Click the lock to prevent further changes.")})]}),(0,R.tZ)("div",{className:"m-l-10 m-t-20 m-b-10",children:ce.map((e=>(0,R.tZ)(d.Y,{value:e.key,inline:!0,onChange:this.onDatasourceTypeChange.bind(this,e.key),checked:this.state.datasourceType===e.key,disabled:!this.state.isEditMode,children:e.label},e.key)))}),(0,R.tZ)("hr",{}),(0,R.BX)(F,{item:o,onChange:this.onDatasourceChange,compact:!0,children:[this.state.datasourceType===he.virtual.key&&(0,R.tZ)("div",{children:this.state.isSqla&&(0,R.BX)(R.HY,{children:[(0,R.BX)(v.JX,{xs:24,md:12,children:[(0,R.tZ)(H,{fieldKey:"databaseSelector",label:(0,g.t)("virtual"),control:(0,R.tZ)("div",{css:Ze,children:(0,R.tZ)(D.Z,{db:null==o?void 0:o.database,catalog:o.catalog,schema:o.schema,onCatalogChange:e=>this.state.isEditMode&&this.onDatasourcePropChange("catalog",e),onSchemaChange:e=>this.state.isEditMode&&this.onDatasourcePropChange("schema",e),onDbChange:e=>this.state.isEditMode&&this.onDatasourcePropChange("database",e),formMode:!1,handleError:this.props.addDangerToast,readOnly:!this.state.isEditMode})})}),(0,R.tZ)("div",{css:(0,n.iv)({width:"calc(100% - 34px)",marginTop:-16},"",""),children:(0,R.tZ)(H,{fieldKey:"table_name",label:(0,g.t)("Name"),control:(0,R.tZ)(K.Z,{controlId:"table_name",onChange:e=>{this.onDatasourcePropChange("table_name",e)},placeholder:(0,g.t)("Dataset name"),disabled:!this.state.isEditMode})})})]}),(0,R.tZ)(H,{fieldKey:"sql",label:(0,g.t)("SQL"),description:(0,g.t)("When specifying SQL, the datasource acts as a view. Superset will use this statement as a subquery while grouping and filtering on the generated parent queries."),control:(0,R.tZ)(L.Z,{language:"sql",offerEditInModal:!1,minLines:20,maxLines:1/0,readOnly:!this.state.isEditMode,resize:"both"})})]})}),this.state.datasourceType===he.physical.key&&(0,R.tZ)(v.JX,{xs:24,md:12,children:this.state.isSqla&&(0,R.tZ)(H,{fieldKey:"tableSelector",label:(0,g.t)("Physical"),control:(0,R.tZ)("div",{css:Ce,children:(0,R.tZ)(A.ZP,{clearable:!1,database:{...o.database,database_name:(null==(t=o.database)?void 0:t.database_name)||(null==(a=o.database)?void 0:a.name)},dbId:null==(i=o.database)?void 0:i.id,handleError:this.props.addDangerToast,catalog:o.catalog,schema:o.schema,sqlLabMode:!1,tableValue:o.table_name,onCatalogChange:this.state.isEditMode?e=>this.onDatasourcePropChange("catalog",e):void 0,onSchemaChange:this.state.isEditMode?e=>this.onDatasourcePropChange("schema",e):void 0,onDbChange:this.state.isEditMode?e=>this.onDatasourcePropChange("database",e):void 0,onTableSelectChange:this.state.isEditMode?e=>this.onDatasourcePropChange("table_name",e):void 0,readOnly:!this.state.isEditMode})}),description:(0,g.t)("The pointer to a physical table (or view). Keep in mind that the chart is associated to this Superset logical table, and this logical table points the physical table referenced here.")})})]})]})}renderErrors(){return this.state.errors.length>0?(0,R.tZ)(h.Z,{css:e=>({marginBottom:4*e.gridUnit}),type:"error",message:(0,R.tZ)(R.HY,{children:this.state.errors.map((e=>(0,R.tZ)("div",{children:e},e)))})}):null}renderMetricCollection(){const{datasource:e}=this.state,{metrics:t}=e,a=null!=t&&t.length?this.sortMetrics(t):[];return(0,R.tZ)(J,{tableColumns:["metric_name","verbose_name","expression"],sortColumns:["metric_name","verbose_name","expression"],columnLabels:{metric_name:(0,g.t)("Metric Key"),verbose_name:(0,g.t)("Label"),expression:(0,g.t)("SQL expression")},columnLabelTooltips:{metric_name:(0,g.t)("This field is used as a unique identifier to attach the metric to charts. It is also used as the alias in the SQL query.")},expandFieldset:(0,R.tZ)(be,{children:(0,R.BX)(F,{compact:!0,children:[(0,R.tZ)(H,{fieldKey:"description",label:(0,g.t)("Description"),control:(0,R.tZ)(K.Z,{controlId:"description",placeholder:(0,g.t)("Description")})}),(0,R.tZ)(H,{fieldKey:"d3format",label:(0,g.t)("D3 format"),control:(0,R.tZ)(K.Z,{controlId:"d3format",placeholder:"%y/%m/%d"})}),(0,R.tZ)(H,{fieldKey:"currency",label:(0,g.t)("Metric currency"),control:(0,R.tZ)(q.Z,{currencySelectOverrideProps:{placeholder:(0,g.t)("Select or type currency symbol")},symbolSelectAdditionalStyles:n.iv`
                      max-width: 30%;
                    `})}),(0,R.tZ)(H,{label:(0,g.t)("Certified by"),fieldKey:"certified_by",description:(0,g.t)("Person or group that has certified this metric"),control:(0,R.tZ)(K.Z,{controlId:"certified_by",placeholder:(0,g.t)("Certified by")})}),(0,R.tZ)(H,{label:(0,g.t)("Certification details"),fieldKey:"certification_details",description:(0,g.t)("Details of the certification"),control:(0,R.tZ)(K.Z,{controlId:"certification_details",placeholder:(0,g.t)("Certification details")})}),(0,R.tZ)(H,{label:(0,g.t)("Warning"),fieldKey:"warning_markdown",description:(0,g.t)("Optional warning about use of this metric"),control:(0,R.tZ)(L.Z,{controlId:"warning_markdown",language:"markdown",offerEditInModal:!1,resize:"vertical"})})]})}),collection:a,allowAddItem:!0,onChange:this.onDatasourcePropChange.bind(this,"metrics"),itemGenerator:()=>({metric_name:(0,g.t)("<new metric>"),verbose_name:"",expression:""}),itemCellProps:{expression:()=>({width:"240px"})},itemRenderers:{metric_name:(e,t,a,n)=>(0,R.BX)(ee,{children:[n.is_certified&&(0,R.tZ)(S.Z,{certifiedBy:n.certified_by,details:n.certification_details}),n.warning_markdown&&(0,R.tZ)(E.Z,{warningMarkdown:n.warning_markdown}),(0,R.tZ)(B.Z,{canEdit:!0,title:e,onSaveTitle:t})]}),verbose_name:(e,t)=>(0,R.tZ)(K.Z,{canEdit:!0,value:e,onChange:t}),expression:(e,t)=>(0,R.tZ)(L.Z,{canEdit:!0,initialValue:e,onChange:t,extraClasses:["datasource-sql-expression"],language:"sql",offerEditInModal:!1,minLines:5,textAreaStyles:{minWidth:"200px",maxWidth:"450px"},resize:"both"}),description:(e,t,a)=>(0,R.tZ)(ge,{label:a,formElement:(0,R.tZ)(K.Z,{value:e,onChange:t})}),d3format:(e,t,a)=>(0,R.tZ)(ge,{label:a,formElement:(0,R.tZ)(K.Z,{value:e,onChange:t})})},allowDeletes:!0,stickyHeader:!0})}render(){const{datasource:e,activeTabKey:t}=this.state,{metrics:a}=e,n=null!=a&&a.length?this.sortMetrics(a):[],{theme:i}=this.props;return(0,R.BX)(Q,{children:[this.renderErrors(),(0,R.tZ)(h.Z,{css:e=>({marginBottom:4*e.gridUnit}),type:"warning",message:(0,R.BX)(R.HY,{children:[" ",(0,R.BX)("strong",{children:[(0,g.t)("Be careful.")," "]}),(0,g.t)("Changing these settings will affect all charts using this dataset, including charts owned by other people.")]})}),(0,R.BX)(te,{fullWidth:!1,id:"table-tabs",onChange:this.handleTabSelect,defaultActiveKey:t,children:[(0,R.tZ)(T.ZP.TabPane,{tab:(0,g.t)("Source"),children:this.renderSourceFieldset(i)},0),(0,R.tZ)(T.ZP.TabPane,{tab:(0,R.tZ)(pe,{collection:n,title:(0,g.t)("Metrics")}),children:this.renderMetricCollection()},1),(0,R.tZ)(T.ZP.TabPane,{tab:(0,R.tZ)(pe,{collection:this.state.databaseColumns,title:(0,g.t)("Columns")}),children:(0,R.BX)(se,{children:[(0,R.tZ)(ie,{children:(0,R.tZ)(le,{children:(0,R.BX)(w.Z,{buttonSize:"small",buttonStyle:"tertiary",onClick:this.syncMetadata,className:"sync-from-source",disabled:this.state.isEditMode,children:[(0,R.tZ)("i",{className:"fa fa-database"})," ",(0,g.t)("Sync columns from source")]})})}),(0,R.tZ)(ue,{className:"columns-table",columns:this.state.databaseColumns,datasource:e,onColumnsChange:e=>this.setColumns({databaseColumns:e}),onDatasourceChange:this.onDatasourceChange}),this.state.metadataLoading&&(0,R.tZ)(I.Z,{})]})},2),(0,R.tZ)(T.ZP.TabPane,{tab:(0,R.tZ)(pe,{collection:this.state.calculatedColumns,title:(0,g.t)("Calculated columns")}),children:(0,R.tZ)(se,{children:(0,R.tZ)(ue,{columns:this.state.calculatedColumns,onColumnsChange:e=>this.setColumns({calculatedColumns:e}),columnLabelTooltips:{column_name:(0,g.t)("This field is used as a unique identifier to attach the calculated dimension to charts. It is also used as the alias in the SQL query.")},onDatasourceChange:this.onDatasourceChange,datasource:e,editableColumnName:!0,showExpression:!0,allowAddItem:!0,allowEditDataType:!0,itemGenerator:()=>({column_name:(0,g.t)("<new column>"),filterable:!0,groupby:!0,expression:(0,g.t)("<enter SQL expression here>"),__expanded:!0})})})},3),(0,R.tZ)(T.ZP.TabPane,{tab:(0,g.t)("Settings"),children:(0,R.BX)(v.X2,{gutter:16,children:[(0,R.tZ)(v.JX,{xs:24,md:12,children:(0,R.tZ)(be,{children:this.renderSettingsFieldset()})}),(0,R.tZ)(v.JX,{xs:24,md:12,children:(0,R.tZ)(be,{children:this.renderAdvancedFieldset()})})]})},4)]})]})}}_e.defaultProps={onChange:()=>{},setIsEditing:()=>{}},_e.propTypes=fe;const ve=(0,_.b)(_e),xe=(0,N.ZP)(ve)},542878:(e,t,a)=>{a.d(t,{Z:()=>b});var n=a(667294),i=a(45697),o=a.n(i),s=a(9875),l=a(61988),r=a(468135),d=a(835932),c=a(749140),h=a(601304),m=a(482342),p=a(135944);const u={name:o().string,onChange:o().func,initialValue:o().string,height:o().number,minLines:o().number,maxLines:o().number,offerEditInModal:o().bool,language:o().oneOf([null,"json","html","sql","markdown","javascript"]),aboveEditorSection:o().node,readOnly:o().bool,resize:o().oneOf([null,"block","both","horizontal","inline","none","vertical"]),textAreaStyles:o().object};class g extends n.Component{onControlChange(e){const{value:t}=e.target;this.props.onChange(t)}onAreaEditorChange(e){this.props.onChange(e)}renderEditor(e=!1){const t=e?40:this.props.minLines||12;if(this.props.language){const a={border:`1px solid ${this.props.theme.colors.grayscale.light1}`,minHeight:`${t}em`,width:"auto",...this.props.textAreaStyles};return this.props.resize&&(a.resize=this.props.resize),this.props.readOnly&&(a.backgroundColor="#f2f2f2"),(0,p.tZ)(c.YH,{mode:this.props.language,style:a,minLines:t,maxLines:e?1e3:this.props.maxLines,editorProps:{$blockScrolling:!0},defaultValue:this.props.initialValue,readOnly:this.props.readOnly,...this.props,onChange:this.onAreaEditorChange.bind(this)},this.props.name)}return(0,p.tZ)(s.Kx,{placeholder:(0,l.t)("textarea"),onChange:this.onControlChange.bind(this),defaultValue:this.props.initialValue,disabled:this.props.readOnly,style:{height:this.props.height}})}renderModalBody(){return(0,p.BX)(p.HY,{children:[(0,p.tZ)("div",{children:this.props.aboveEditorSection}),this.renderEditor(!0)]})}render(){const e=(0,p.tZ)(m.Z,{...this.props});return(0,p.BX)("div",{children:[e,this.renderEditor(),this.props.offerEditInModal&&(0,p.tZ)(h.Z,{modalTitle:e,triggerNode:(0,p.BX)(d.Z,{buttonSize:"small",className:"m-t-5",children:[(0,l.t)("Edit")," ",(0,p.tZ)("strong",{children:this.props.language})," ",(0,l.t)("in modal")]}),modalBody:this.renderModalBody(!0),responsive:!0})]})}}g.propTypes=u,g.defaultProps={onChange:()=>{},initialValue:"",height:250,minLines:3,maxLines:10,offerEditInModal:!0,readOnly:!1,resize:null,textAreaStyles:{}};const b=(0,r.b)(g)},657011:(e,t,a)=>{a.d(t,{Z:()=>o});var n=a(806048),i=a(135944);const o=({padded:e,...t})=>(0,i.tZ)(n.Z,{...t,css:t=>({".antd5-card-body":{padding:e?4*t.gridUnit:t.gridUnit}})})},787253:(e,t,a)=>{a.d(t,{lU:()=>l.lU,zq:()=>l.zq,ZP:()=>s});var n=a(751995),i=a(135944);const o=n.iK.span`
  &,
  & svg {
    vertical-align: top;
  }
`;function s({checked:e,onChange:t,style:a,className:n}){return(0,i.tZ)(o,{style:a,onClick:()=>{t(!e)},role:"checkbox",tabIndex:0,"aria-checked":e,"aria-label":"Checkbox",className:n||"",children:e?(0,i.tZ)(l.lU,{}):(0,i.tZ)(l.zq,{})})}var l=a(513842)},138270:(e,t,a)=>{a.d(t,{Z:()=>u});var n=a(667294),i=a(473727),o=a(693967),s=a.n(o),l=a(751995),r=a(61988),d=a(211965),c=a(358593),h=a(679789),m=a(135944);const p=(0,l.iK)(h.Z)`
  vertical-align: middle;
`;function u({canEdit:e=!1,editing:t=!1,extraClasses:a,multiLine:o=!1,noPermitTooltip:l,onSaveTitle:h,showTooltip:u=!0,style:g,title:b="",defaultTitle:f="",placeholder:y="",certifiedBy:Z,certificationDetails:C,url:_,...v}){const[x,w]=(0,n.useState)(t),[T,S]=(0,n.useState)(b),[E,D]=(0,n.useState)(b),[k,I]=(0,n.useState)(null),A=(0,n.useRef)();function B(){if(!e||x)return;const t=A.current?A.current.getBoundingClientRect():null;w(!0),I(t)}function M(){const t=T.trim();e&&(w(!1),t.length?(E!==t&&D(t),b!==t&&h(t)):S(E))}function K(e){" "===e.key&&e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),M())}function L(t){e&&S(t.target.value)}function P(e){"Enter"===e.key&&(e.preventDefault(),M())}let N;(0,n.useEffect)((()=>{b!==T&&(D(T),S(b))}),[b]),(0,n.useEffect)((()=>{if(x&&(A.current.focus(),A.current.setSelectionRange)){const{length:e}=A.current.value;A.current.setSelectionRange(e,e),A.current.scrollLeft=A.current.scrollWidth,A.current.scrollTop=A.current.scrollHeight}}),[x]),N=T,x||T||(N=f||b);const X=x&&k?{height:`${k.height}px`}:void 0;let q=o&&x?(0,m.tZ)("textarea",{ref:A,value:N,className:b?void 0:"text-muted",onKeyDown:K,onChange:L,onBlur:M,onClick:B,onKeyPress:P,placeholder:y,style:X}):(0,m.tZ)("input",{ref:A,type:x?"text":"button",value:N,className:b?void 0:"text-muted",onKeyDown:K,onChange:L,onBlur:M,onClick:B,onKeyPress:P,placeholder:y});return u&&!x&&(q=(0,m.tZ)(c.u,{id:"title-tooltip",title:e?(0,r.t)("Click to edit"):l||(0,r.t)("You don't have the rights to alter this title."),children:q})),e||(q=_?(0,m.tZ)(i.rU,{to:_,css:e=>d.iv`
          color: ${e.colors.grayscale.dark1};
          text-decoration: none;
          :hover {
            text-decoration: underline;
          }
          display: inline-block;
        `,children:N}):(0,m.tZ)("span",{children:N})),(0,m.BX)("span",{className:s()("editable-title",a,e&&"editable-title--editable",x&&"editable-title--editing"),style:g,...v,children:[Z&&(0,m.BX)(m.HY,{children:[(0,m.tZ)(p,{certifiedBy:Z,details:C,size:"xl"})," "]}),q]})}},999075:(e,t,a)=>{a.d(t,{J:()=>o});var n=a(219181),i=a(135944);const o=e=>(0,i.tZ)(n.Z,{...e})}}]);
//# sourceMappingURL=ded7f8082a9bd61a5d4a.chunk.js.map